Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21590f70c5 | ||
|
|
71706478c2 | ||
|
|
3b9a6f3743 |
@@ -1,7 +1,40 @@
|
||||
* text=auto eol=lf
|
||||
|
||||
# Byte pins and source anchors require LF on every platform. Binary overrides keep
|
||||
# normalization from corrupting media, fonts and archives.
|
||||
*.bin binary
|
||||
*.ttf binary
|
||||
*.otf binary
|
||||
*.woff binary
|
||||
*.woff2 binary
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
*.jpeg binary
|
||||
*.gif binary
|
||||
*.webp binary
|
||||
*.avif binary
|
||||
*.ico binary
|
||||
*.wav binary
|
||||
*.mp3 binary
|
||||
*.flac binary
|
||||
*.ogg binary
|
||||
*.m4a binary
|
||||
*.mp4 binary
|
||||
*.webm binary
|
||||
*.mov binary
|
||||
*.zip binary
|
||||
*.7z binary
|
||||
*.tar binary
|
||||
*.gz binary
|
||||
*.bz2 binary
|
||||
*.xz binary
|
||||
|
||||
# Exact native observer admission hashes checkout bytes, not only the Git blob.
|
||||
scripts/process_audio_observer.py text eol=lf
|
||||
# Runtime font authority pins LF text; keep default Windows checkouts usable.
|
||||
comfyui_h3_context/fonts/LICENSE-OFL-1.1.txt text eol=lf
|
||||
comfyui_h3_context/fonts/LICENSE-NotoSansCJK-OFL-1.1.txt text eol=lf
|
||||
comfyui_h3_context/fonts/*.otf binary
|
||||
comfyui_h3_context/fonts/font_manifest_v1.json text eol=lf
|
||||
# Compatibility retention hashes immutable checkout bytes; CRLF would reject this authority.
|
||||
comfyui_h3_context/contracts/authoring_renderer_qualification_v1.json text eol=lf
|
||||
|
||||
@@ -167,6 +167,18 @@ jobs:
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1
|
||||
with:
|
||||
python-version: "3.10"
|
||||
cache: pip
|
||||
# CRITICAL: unit tests compare title-font decisions with the real backend through the
|
||||
# repository's .venv interpreter; without it they fail rather than skip.
|
||||
- name: Prepare backend interpreter for unit tests
|
||||
shell: bash
|
||||
run: |
|
||||
python -m venv .venv
|
||||
.venv/bin/python -m pip install --disable-pip-version-check -e .
|
||||
- name: Set up Node 24
|
||||
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38
|
||||
with:
|
||||
|
||||
+11
-4
@@ -6,10 +6,13 @@ repos:
|
||||
hooks:
|
||||
- id: check-merge-conflict
|
||||
- id: check-added-large-files
|
||||
# These four packaged font artifacts are size/hash checked by their runtime reader.
|
||||
exclude: ^comfyui_h3_context/fonts/NotoSans-(?:Regular|Italic|Bold|BoldItalic)\.ttf$
|
||||
# These twelve packaged font artifacts are size/hash checked by their runtime reader.
|
||||
exclude: ^comfyui_h3_context/fonts/(?:NotoSans-(?:Regular|Italic|Bold|BoldItalic)\.ttf|NotoSans(?:TC|SC|JP|KR)-(?:Regular|Bold)\.otf)$
|
||||
- id: check-toml
|
||||
- id: check-yaml
|
||||
- id: fix-byte-order-marker
|
||||
- id: mixed-line-ending
|
||||
args: [--fix=lf]
|
||||
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: 39d9ac5938dadb73df0564a45f163e25ff9fa6e2 # v0.16.1 # pragma: allowlist secret
|
||||
@@ -54,6 +57,10 @@ repos:
|
||||
rev: 68e8b45440415753fff70a312ece8da92ba85b4a # v1.5.0 # pragma: allowlist secret
|
||||
hooks:
|
||||
- id: detect-secrets
|
||||
args: ["--baseline", "requirements/secret-scan-baseline.json"]
|
||||
# CRITICAL: --no-verify keeps the result independent of any network service and sends
|
||||
# no candidate to one. Without it, AWS key candidates go to a verification service,
|
||||
# refused ones are dropped, and on Linux the hook then trims the approved baseline rows
|
||||
# and fails.
|
||||
args: ["--no-verify", "--baseline", "requirements/secret-scan-baseline.json"]
|
||||
# The hash-only baseline is scanner metadata, not a credential-bearing source file.
|
||||
exclude: ^(?:\.secrets\.baseline|requirements/secret-scan-baseline\.json)$
|
||||
exclude: ^(?:\.secrets\.baseline|requirements/secret-scan-baseline\.json|comfyui_h3_context/fonts/NotoSans(?:TC|SC|JP|KR)-(?:Regular|Bold)\.otf)$
|
||||
|
||||
@@ -7,6 +7,14 @@ The fonts are licensed under the SIL Open Font License, Version 1.1.
|
||||
Their copyright notice and complete license are included in
|
||||
comfyui_h3_context/fonts/LICENSE-OFL-1.1.txt.
|
||||
|
||||
This distribution also includes unmodified Noto Sans TC, SC, JP and KR fonts,
|
||||
release Noto Sans CJK 2.004, regular and bold, from
|
||||
https://github.com/notofonts/noto-cjk (tag Sans2.004).
|
||||
© 2014-2021 Adobe (http://www.adobe.com/).
|
||||
These fonts are licensed under the SIL Open Font License, Version 1.1.
|
||||
Their complete license is included in
|
||||
comfyui_h3_context/fonts/LICENSE-NotoSansCJK-OFL-1.1.txt.
|
||||
|
||||
The compiled sidebar, comfyui_h3_context/web/h3-context-sidebar.js, includes
|
||||
React 19.2.8, ReactDOM 19.2.8 and Scheduler 0.27.0. All three are licensed under
|
||||
the MIT License and share one copyright notice:
|
||||
|
||||
@@ -18,6 +18,73 @@ implementation.
|
||||
|
||||
<details>
|
||||
|
||||
<summary><strong>1.4.6 — Longer videos on ComfyUI 0.44 and later</strong></summary>
|
||||
|
||||
- Longer videos are no longer held on ComfyUI 0.44 and later. Version 1.4.5 did not recognize the
|
||||
native MiniMax H3 source those versions ship, so it held longer-video generation in T2VA and in
|
||||
the frame modes (I2VA, FL2VA and L2VA). This version recognizes it. ComfyUI versions that 1.4.5
|
||||
already recognized are handled as before.
|
||||
- A two-segment T2VA longer video was generated on ComfyUI 0.46.0 with frontend 1.59.11, using
|
||||
a 4-step turbo LoRA.
|
||||
- When the extension does not recognize the MiniMax H3 nodes of your ComfyUI, the message now says
|
||||
so: update ComfyUI, and if it is already up to date, update this extension when a newer version
|
||||
is available. A single clip in H3 App Mode still works.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
|
||||
<summary><strong>1.4.5 — Longer videos from frames, CJK titles and title styles</strong></summary>
|
||||
|
||||
- Longer videos can now be generated in I2VA, FL2VA and L2VA, as in T2VA, with cuts between
|
||||
segments. The opening frame belongs to the first segment and the closing frame to the last.
|
||||
Ref2VA plans can be proposed and reviewed; their generation is not available yet.
|
||||
- In Ref2VA whole-video plans, a first-frame reference belongs only to the opening segment and a
|
||||
last-frame reference only to the closing segment.
|
||||
- Planning accepts Contexts whose plan-level sections name a reference or subject label, and a
|
||||
production Context with a subject but no dialogue can be prepared for generation.
|
||||
- Titles can use Traditional Chinese, Simplified Chinese, Japanese and Korean text, in regular
|
||||
and bold. The bundled fonts make the download larger. Versions 1.4.0 and 1.4.1 open these
|
||||
projects but refuse CJK title editing and rendering.
|
||||
- Eight **Title styles**, such as **Outline**, **Drop shadow** and **Caption box**, in the media
|
||||
bin's and the Inspector's **Text** tab. A style keeps the title's text, font, size, alignment
|
||||
and line height.
|
||||
- A prepared I2VA canvas no longer carries an unconnected resolution selector.
|
||||
- Fixed: **Start H3 App Mode** on the **Execute / Export** step works on a canvas App Mode
|
||||
prepared or that holds a compatible H3 graph. In 1.4.1 and earlier, the sidebar asked again
|
||||
whether to keep or replace the canvas, and nothing was queued.
|
||||
- Fixed: after you crop an image and prepare the canvas, starting from the sidebar works. In
|
||||
1.4.0 and 1.4.1 it stopped with an error, and nothing was queued.
|
||||
- Long Windows paths are handled consistently in rendering and segment storage. On Windows,
|
||||
rendering needs a ComfyUI folder path of at most 96 characters and refuses a deeper one before
|
||||
it starts.
|
||||
- New checkouts use LF line endings on every platform.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
|
||||
<summary><strong>1.4.1 — Newer ComfyUI frontends and clip editor fixes</strong></summary>
|
||||
|
||||
- App Mode works with ComfyUI frontend 1.56.1 and later. These frontends add node pack details to
|
||||
the compiled workflow, which 1.4.0 refused with "The visible H3 graph could not be compiled."
|
||||
- The clip editor and image crop open with ComfyUI frontend 1.57.1 and later, where 1.4.0 said the
|
||||
full editor was unavailable and the image could not be opened. Keys used inside them, such as
|
||||
Ctrl+Z, still stay there instead of changing the canvas.
|
||||
- The sidebar, crop dialog and clip editor follow ComfyUI's light or dark palette on newer
|
||||
frontends too. Before, they could turn light while ComfyUI used a dark palette.
|
||||
- The sidebar stays within the window on older and newer frontends, including after you make the
|
||||
window narrower. Before, it could reach past the window edge.
|
||||
- Hover descriptions of the clip editor's icon buttons keep a readable width. A button alone in its
|
||||
group no longer squeezes its description into a narrow column.
|
||||
- The empty preview monitor and empty timeline tracks now say to click a thumbnail in **Media**,
|
||||
instead of mentioning a **+** button the media bin does not show.
|
||||
- **Settings → Language** names the Traditional Chinese option 正體中文.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
|
||||
<summary><strong>1.4.0 — Directional wipes, image cropping and easier App Mode setup</strong></summary>
|
||||
|
||||
- The clip editor adds four directional wipes, **Wipe from left**, **Wipe from right**,
|
||||
@@ -236,12 +303,17 @@ Public source and Registry packages include the test suites and their support fi
|
||||
|
||||
- **ComfyUI** with its native MiniMax H3 nodes (`MiniMaxH3ImageToVideo`,
|
||||
`MiniMaxH3ReferenceToVideo`), the official `video_minimax_h3_*` workflow templates and a frontend
|
||||
that supports sidebar extensions. Python 3.10 or newer.
|
||||
that supports sidebar extensions. Python 3.10 or newer. Longer videos in the frame modes also
|
||||
use the native `MiniMaxH3AddGuide` node.
|
||||
- **MiniMax H3 model weights** and suitable hardware to generate video. Building and checking
|
||||
prompts needs no weights.
|
||||
- **Windows x64 with 64-bit Python** for the clip editor, Production import, longer-video assembly
|
||||
and final rendering, plus the [media tools](#media-tools), which you provide and the extension
|
||||
verifies. Linux support for these features is coming in an upcoming update.
|
||||
- **A short ComfyUI folder path on Windows** for final-video rendering. The longest scratch-stage
|
||||
file path must fit within 259 UTF-16 code units, so the ComfyUI folder's absolute path can be at
|
||||
most 96 UTF-16 code units. Deeper installations are refused before rendering starts, whatever the
|
||||
Windows long-path settings; move ComfyUI to a shorter folder.
|
||||
|
||||
The package has no required Python dependencies and never installs or changes ComfyUI, its
|
||||
frontend or your models.
|
||||
@@ -254,8 +326,11 @@ message names it. The canvas nodes keep working even when the sidebar cannot loa
|
||||
|
||||
- The prompt pipeline runs on Windows, Linux and WSL. The media features need Windows x64 for now;
|
||||
Linux support for them is coming in an upcoming update.
|
||||
- The clip editor and image crop have been tested on ComfyUI 0.41.0 with frontend 1.55.18. This is
|
||||
a tested combination, not a minimum version.
|
||||
- The clip editor, image crop and App Mode have been tested on ComfyUI 0.42.0 with frontend 1.55.18
|
||||
and with frontend 1.57.1. Longer videos in the frame modes, and starting on a crop-prepared
|
||||
canvas, have been tested on ComfyUI 0.42.0 with frontend 1.57.1. A two-segment T2VA longer video
|
||||
was generated on ComfyUI 0.46.0 with frontend 1.59.11, using a 4-step turbo LoRA. These
|
||||
are tested combinations, not minimum versions.
|
||||
- Longer-video generation checks the installed H3 implementation separately. If it reports an
|
||||
incompatibility, use a complete, compatible ComfyUI installation; installing FFmpeg or waiting
|
||||
does not fix it.
|
||||
@@ -372,7 +447,7 @@ Open **MiniMax H3 Studio** from the ComfyUI sidebar. It has three pages:
|
||||
| Production | Your generated clips as a project, longer-video planning, and the entry to the clip editor |
|
||||
| Settings | Language, media tools, recovery metadata, retained media, local-perception status and the optional assisted-authoring provider |
|
||||
|
||||
**Settings → Language** offers **Automatic (ComfyUI locale)**, English, 繁體中文 and 简体中文.
|
||||
**Settings → Language** offers **Automatic (ComfyUI locale)**, English, 正體中文 and 简体中文.
|
||||
|
||||
**Settings → Local perception** shows whether the host's existing visual and audio setup is
|
||||
available. **Refresh status** reads its readiness; it does not install dependencies, launch a
|
||||
@@ -666,7 +741,7 @@ reference images.
|
||||
- **Import** brings in the outputs selected in Production: up to three finished segments. If the
|
||||
selection also contains unfinished segments, the button reads **Import ready (2 of 3)** and imports
|
||||
only the finished ones. Importing adds sources to the bin; it does not place them on the
|
||||
timeline or start a generation. The bin holds up to 128 items.
|
||||
timeline or start a generation. The bin holds up to 128 items, including the five bundled title fonts.
|
||||
- **Search media**, **Sort and filter** (source or reverse order; all media, videos, pictures, or
|
||||
those already added to the timeline) and **Grid view** / **List view** help in a full bin.
|
||||
- Click a card to add it: a video goes to the end of the **Main** track, a picture goes to a
|
||||
@@ -688,6 +763,11 @@ length. One **Undo** removes both the new track and its title. You can add the f
|
||||
empty project. If insertion is unavailable, the disabled button's explanation says what to change,
|
||||
such as freeing a track or choosing a font.
|
||||
|
||||
Under **Title styles**, the **Text** tab also offers eight ready-made styles: **Outline**, **Yellow
|
||||
outline**, **Drop shadow**, **Outline and shadow**, **Caption box**, **Highlight**, **Inverse box**
|
||||
and **Bold outline**. Each card previews its style; choosing one inserts the title text with that
|
||||
style.
|
||||
|
||||
### Timeline
|
||||
|
||||
The timeline has the **Main** video track plus video, picture and text overlay tracks: up to eight
|
||||
@@ -780,6 +860,11 @@ one group preserves the other title settings. Decoration opacity is 1–255, whi
|
||||
background opacity also allow zero. Shadows use a sharp edge and follow the clip's scale and
|
||||
rotation.
|
||||
|
||||
For a selected title, **Title styles** in the **Text** tab applies one of the same eight styles.
|
||||
A style sets the weight, fill colour, stroke, shadow, background and background padding, turns
|
||||
italic off, and replaces any stroke, shadow or padding the title had. It keeps the text, font,
|
||||
size, alignment and line height. Applying a style is one undo step.
|
||||
|
||||
- Sliders apply when you release them. Number fields apply on **Enter** or the group's apply
|
||||
button; moving focus away does not apply them. **Escape** cancels a change, and **Reset** restores
|
||||
the whole group as one undo step.
|
||||
@@ -813,12 +898,16 @@ output** and **Download original**. **Preview output** plays a smaller 640 × 36
|
||||
**Download original** gives the full-size file. A render made before later edits is labelled
|
||||
**Output from an earlier revision**.
|
||||
|
||||
Titles use the bundled Noto Sans fonts, which cover Latin, Greek and Cyrillic characters only.
|
||||
**Add title** and the Inspector refuse title text or a style change that needs other characters,
|
||||
such as Chinese, Japanese, Korean or emoji, and say why; the text you typed stays in place. A
|
||||
title like this from an older project still opens and can be moved, trimmed or deleted. It cannot
|
||||
be rendered, and its style cannot be changed, until you edit its text to characters the fonts
|
||||
cover.
|
||||
Titles use bundled Noto Sans for Latin, Greek and Cyrillic, and Noto Sans TC, SC, JP and KR
|
||||
2.004 for Traditional Chinese, Simplified Chinese, Japanese and Korean. CJK supports regular and
|
||||
bold, with no italic substitution. The **Font** list shows these faces as **Font 01** to
|
||||
**Font 05**: Noto Sans, then TC, SC, JP and KR. The chosen face is used when it covers the whole
|
||||
title. Otherwise kana prefers Japanese forms, Hangul prefers Korean forms, and other text tries
|
||||
Noto Sans, TC, SC, JP, then KR. One bundled face must cover the whole title;
|
||||
emoji and other uncovered characters are refused with an explanation. No system font is used.
|
||||
|
||||
CJK titles need 1.4.5 or later. Opening a saved CJK project in 1.4.0 or 1.4.1 keeps its text and
|
||||
permits moving, trimming or deleting the title, but CJK editing and rendering are refused.
|
||||
|
||||
Rendered files are kept for about an hour, at most 16 at a time. Download the ones you want to keep.
|
||||
|
||||
@@ -888,8 +977,12 @@ it must fit in 15 seconds). A script holds up to 32 shots. **Load shots from Con
|
||||
shots the Context already describes as a starting point.
|
||||
|
||||
Exact dialogue, on-screen text and timing instructions from the Context stay in the opening part of
|
||||
the video, and no cut is placed inside a shot that holds exact text. Plans that use reference media
|
||||
can be proposed and reviewed, but generation currently accepts text-to-video plans only.
|
||||
the video, and no cut is placed inside a shot that holds exact text. Sequence generation supports
|
||||
text to video (T2VA), image to video (I2VA), first and last frame (FL2VA) and last frame (L2VA),
|
||||
with cuts between segments. The opening frame belongs to the first segment and the closing frame
|
||||
to the last. Keep the declared **Load Image** nodes, images and crops available on the original
|
||||
workflow throughout generation. Reference set (Ref2VA) plans can be proposed and reviewed;
|
||||
sequence generation for that mode is not available yet.
|
||||
|
||||
### Generate and assemble in the editor
|
||||
|
||||
@@ -1085,8 +1178,11 @@ Review workflows and screenshots before sharing them. More detail is in
|
||||
|
||||
## Known limitations
|
||||
|
||||
- **Longer videos** generate text-to-video plans only. Readiness is valid for about a minute. After a
|
||||
page reload, a running sequence can be viewed but not resumed: cancel it and start again.
|
||||
- **Longer videos** support T2VA and the three frame modes (I2VA, FL2VA, L2VA) with cuts between
|
||||
segments; Ref2VA sequence generation is not available yet. Readiness checks plan and host
|
||||
support for about a minute; frame sources are checked when generation starts and before each
|
||||
segment. After a page reload, a running sequence can be viewed but not resumed: cancel it and
|
||||
start again.
|
||||
- **Audio as the only reference** is not offered.
|
||||
- **Image crop** works on images from 32 to 16,384 pixels per side, and a crop is at least 32
|
||||
pixels wide and high.
|
||||
@@ -1102,9 +1198,9 @@ Review workflows and screenshots before sharing them. More detail is in
|
||||
is coming in an upcoming update); unacknowledged edits can be lost. Rendered files remain
|
||||
temporary and are kept for about an hour.
|
||||
- **Previews** in the monitor are approximate; check the rendered file.
|
||||
- **Title characters**: the bundled Noto Sans fonts cover Latin, Greek and Cyrillic characters
|
||||
only. The editor refuses titles with other characters, such as Chinese, Japanese, Korean or
|
||||
emoji, and such a title from an older project cannot be rendered into the final video.
|
||||
- **Title characters**: bundled fonts cover Latin, Greek, Cyrillic and regional CJK. CJK supports
|
||||
regular and bold; turn off italic. A single face must cover the whole title. Emoji and other
|
||||
uncovered characters remain unsupported.
|
||||
- **Quality**: validation and guide readiness check the prompt, not the visual result, and do not
|
||||
make this equivalent to MiniMax's own implementation.
|
||||
- **Local perception** requires the qualified native Windows setup described in the host
|
||||
@@ -1145,8 +1241,9 @@ Review workflows and screenshots before sharing them. More detail is in
|
||||
| An imported clip is in the bin but not on the timeline | Import only adds sources; click its card. |
|
||||
| An imported clip became unavailable | Keep its Production project available, or open a saved project and explicitly relink compatible retained media. A released source is never silently replaced. |
|
||||
| **Add title** is unavailable | Read the reason beside the button. Choose an available font, shorten the text, or free a text track at the playhead when all eight track slots are in use. |
|
||||
| The final render says the title font cannot render some characters | Edit the title text to Latin, Greek or Cyrillic characters, or delete the title, then render again. |
|
||||
| **Add title** says some characters are not supported | Use Latin, Greek or Cyrillic characters. The bundled title font does not include others, such as Chinese, Japanese, Korean or emoji. |
|
||||
| The final render says the title font cannot render some characters | Remove uncovered characters, or turn off italic for CJK text, then render again. |
|
||||
| The final render says the ComfyUI folder path is too deep | On Windows, move ComfyUI to a folder whose absolute path is at most 96 characters, then render again. |
|
||||
| **Add title** says some characters are not supported | Use supported Latin, Greek, Cyrillic or CJK characters. Remove uncovered characters such as emoji. CJK supports regular and bold only. |
|
||||
| A number changed but the picture did not | Number fields apply on **Enter** or the group's apply button. |
|
||||
| On-picture handles are missing | Select one clip, put the playhead inside it, and make sure the clip and track are enabled and unlocked. |
|
||||
| The Audio tab is missing or has no effect | It appears only for a video with sound, and is heard only on the **Main** track. |
|
||||
@@ -1159,6 +1256,7 @@ Review workflows and screenshots before sharing them. More detail is in
|
||||
| A sequence cannot be resumed after a reload | Cancel it and start again. |
|
||||
| Readiness expired before generating | Choose **Check readiness** again. |
|
||||
| Readiness says the host does not provide every native MiniMax H3 workflow | The loaded native H3 implementation is incomplete or not supported; use a complete, compatible ComfyUI installation. |
|
||||
| Readiness says the MiniMax H3 nodes in this ComfyUI are a version this extension cannot use for longer videos | Update ComfyUI. If it is already up to date, update this extension when a newer version is available. A single clip in H3 App Mode still works. |
|
||||
| A remote assisted-authoring profile does not run | Check the message, profile, permission, API key and your provider quota. |
|
||||
|
||||
When reporting a problem, include the node name, the diagnostic code and the profile or contract
|
||||
|
||||
@@ -1,3 +1,182 @@
|
||||
# Release 1.4.6
|
||||
|
||||
## Longer videos on ComfyUI 0.44 and later
|
||||
|
||||
- Longer videos are no longer held on ComfyUI 0.44 and later. Version 1.4.5 did not recognize the
|
||||
native MiniMax H3 source those versions ship, so it held longer-video generation in T2VA and in
|
||||
the frame modes (I2VA, FL2VA and L2VA). This version recognizes it. ComfyUI versions that 1.4.5
|
||||
already recognized are handled as before.
|
||||
- When the extension does not recognize the MiniMax H3 nodes of your ComfyUI, the message now says
|
||||
so and what to do: update ComfyUI, and if it is already up to date, update this extension when a
|
||||
newer version is available. A single clip in H3 App Mode still works. Before, the message said
|
||||
only that the host did not provide every native workflow that sequence generation needs.
|
||||
|
||||
## Compatibility
|
||||
|
||||
- A two-segment T2VA longer video was generated on ComfyUI 0.46.0 with frontend 1.59.11, using
|
||||
a 4-step turbo LoRA. This is a tested combination, not a minimum version.
|
||||
|
||||
# Release 1.4.5
|
||||
|
||||
## Longer videos in the frame modes
|
||||
|
||||
- Longer videos can now be generated in I2VA, FL2VA and L2VA, as in T2VA, with cuts between
|
||||
segments. The opening frame belongs to the first segment and the closing frame to the last.
|
||||
These modes also use ComfyUI's native `MiniMaxH3AddGuide` node, which the readiness check looks
|
||||
for.
|
||||
- Keep the declared **Load Image** nodes, images and crops available on the original workflow
|
||||
throughout generation. Frame sources are checked when generation starts and before each segment.
|
||||
- Ref2VA plans can be proposed and reviewed; sequence generation for that mode is not available
|
||||
yet. After a page reload, a running sequence can be viewed but not resumed: cancel it and start
|
||||
again.
|
||||
|
||||
## Planning longer videos
|
||||
|
||||
- In a Ref2VA whole-video plan, a first-frame reference now belongs only to the opening segment and
|
||||
a last-frame reference only to the closing segment. Other references still appear in every
|
||||
segment. Before, every segment described the same picture as its own first or last frame.
|
||||
- Planning from the generated storyboard accepts a Context whose plan-level sections, such as the
|
||||
summary or the overall soundscape, name a reference or subject label such as `<Picture 2>`.
|
||||
Before, it was refused; planning from reviewed rows was not affected.
|
||||
- A production Context that declares a subject but no dialogue can now be prepared for
|
||||
generation. Before, its subject label was refused as invalid.
|
||||
|
||||
## Titles
|
||||
|
||||
- Titles include the unmodified Noto Sans TC, SC, JP and KR 2.004 regional fonts in regular and
|
||||
bold, listed in the **Font** list as **Font 02** to **Font 05** after Noto Sans. Preview and
|
||||
final rendering select the same whole-text face: the chosen face when it covers the whole
|
||||
title; otherwise kana prefers Japanese forms, Hangul prefers Korean forms, and other text tries
|
||||
Noto Sans, TC, SC, JP, then KR.
|
||||
- CJK italic is refused with a localized explanation; turn off italic. Emoji and other
|
||||
uncovered characters remain unsupported. The larger font package is included in the download.
|
||||
- CJK titles need 1.4.5 or later. A CJK project still opens in 1.4.0 and 1.4.1, but those versions
|
||||
refuse CJK title editing and rendering.
|
||||
- Eight title styles: **Outline**, **Yellow outline**, **Drop shadow**, **Outline and shadow**,
|
||||
**Caption box**, **Highlight**, **Inverse box** and **Bold outline**. In the media bin's **Text**
|
||||
tab, **Title styles** inserts a title with the chosen style. For a selected title, **Title
|
||||
styles** in the Inspector's **Text** tab applies it as one undo step.
|
||||
- A style sets the weight, fill colour, stroke, shadow, background and background padding, and
|
||||
turns italic off. It keeps the text, font, size, alignment and line height.
|
||||
|
||||
## App Mode
|
||||
|
||||
- When App Mode prepares an I2VA canvas, it no longer leaves the template's resolution selector
|
||||
on the canvas unconnected. The output size follows the first-frame image, as before; editing
|
||||
that selector had no effect.
|
||||
|
||||
## Fixed
|
||||
|
||||
- **Start H3 App Mode** on the **Execute / Export** step works on a canvas that App Mode prepared,
|
||||
or that already holds a compatible H3 graph. In 1.4.1 and earlier versions, the sidebar asked
|
||||
again whether to keep or replace the canvas, and nothing was queued.
|
||||
- After you crop a first frame, last frame or reference image and prepare the canvas, starting
|
||||
from the sidebar works. In 1.4.0 and 1.4.1 the sidebar stopped with an error and nothing was
|
||||
queued. ComfyUI's own Run on the same canvas was not affected.
|
||||
|
||||
## Windows storage
|
||||
|
||||
- Rendering and segment storage handle long Windows paths consistently when staging, publishing
|
||||
and cleaning up files. Existing path, identity and no-clobber checks still apply.
|
||||
- On Windows, final-video rendering needs the ComfyUI folder's absolute path to be at most 96
|
||||
UTF-16 code units, so that the longest scratch-stage file path fits within 259. A deeper
|
||||
installation is refused before rendering starts, with a message to move ComfyUI to a shorter
|
||||
folder. Windows long-path settings do not change this.
|
||||
|
||||
## Source checkouts
|
||||
|
||||
- Text files in new checkouts now use LF on every platform, including Windows with
|
||||
`core.autocrlf=true`. Updating an existing clone needs no extra action. Files the update does
|
||||
not change may keep Windows line endings; the extension tolerates them.
|
||||
|
||||
## Compatibility
|
||||
|
||||
- The frame-mode sequences and the start on a crop-prepared canvas were tested on ComfyUI 0.42.0
|
||||
with frontend 1.57.1.
|
||||
|
||||
## Developer notes
|
||||
|
||||
- `docs/DEVELOPMENT.md` explains how to renormalize a Windows clone made before the LF change.
|
||||
- A pre-commit hook and a test refuse tracked text files that start with a UTF-8 byte-order mark.
|
||||
- The clip editor's media transport refuses a video element whose metadata has not loaded, with a
|
||||
distinct internal code, instead of waiting for a first frame that may never arrive. Product code
|
||||
already waits for metadata, so users see no change.
|
||||
|
||||
## Upgrade and limits
|
||||
|
||||
Replace the complete package, restart ComfyUI and refresh the browser. The download is larger
|
||||
because it includes the CJK title fonts. Projects and settings from 1.4.1 open in 1.4.5. The
|
||||
supported FFmpeg build and platform requirements are unchanged; on Windows, rendering now needs a
|
||||
ComfyUI folder path of at most 96 characters (see "Windows storage").
|
||||
|
||||
---
|
||||
|
||||
# Release 1.4.1
|
||||
|
||||
## Newer ComfyUI frontends
|
||||
|
||||
- App Mode works with ComfyUI frontend 1.56.1 and later. These frontends add the node pack's
|
||||
identity (`cnr_id`, `aux_id` and `ver`) beside each node's title in the compiled workflow. 1.4.0
|
||||
accepted only the title there, so preparing, connecting or queueing an H3 graph stopped with "The
|
||||
visible H3 graph could not be compiled." These three details are now accepted as short text; any
|
||||
other addition is still refused. Earlier frontends behave as before.
|
||||
- The clip editor and image crop open with frontend 1.57.1 and later. These frontends report
|
||||
whether ComfyUI's mask editor is open in a different way, so 1.4.0 could not keep its own keys
|
||||
apart from ComfyUI's shortcuts there: **Open full editor** said the full editor was unavailable,
|
||||
and **Crop image** said the image could not be opened. Both ways are now supported. Keys used
|
||||
inside the editor or the crop dialog, such as Ctrl+Z, still stay there instead of changing the
|
||||
canvas, and ComfyUI's own shortcuts work again once they close.
|
||||
- ComfyUI frontends from 1.59.0 no longer mark a dark palette the way earlier frontends do, so
|
||||
1.4.0 showed the sidebar, crop dialog and clip editor in light colours even with a dark palette.
|
||||
They now also read the palette's colour scheme, and earlier frontends' dark-palette marker works
|
||||
as before.
|
||||
- Frontend 1.57.1 and later lay out the side panels differently, so 1.4.0 lost the sidebar's width
|
||||
limits there: it kept its minimum width in a narrow window and could reach past the window edge.
|
||||
The sidebar now finds both panel layouts and stays within the window and clear of a panel open on
|
||||
the other side. It keeps its usual minimum width when the window has room.
|
||||
- On earlier frontends, a sidebar at its minimum width could stay too wide after the window was
|
||||
made narrower, and reach past the window edge until the window was widened again. It now follows
|
||||
the window in both directions, on every frontend.
|
||||
|
||||
## Clip editor
|
||||
|
||||
- Hover descriptions of icon buttons keep a readable width, up to the space the editor shows. A
|
||||
button alone in its group used to squeeze its description to the button's width, which split
|
||||
words across lines.
|
||||
- The empty preview monitor and empty timeline tracks now say to click a thumbnail in **Media**,
|
||||
which adds it to the timeline. They no longer mention a **+** button that the media bin does not
|
||||
show. The hints are updated in English, Traditional Chinese and Simplified Chinese.
|
||||
|
||||
## Language setting
|
||||
|
||||
- **Settings → Language** lists the Traditional Chinese option as 正體中文, in every interface
|
||||
language. The saved setting is unchanged, so an existing choice stays selected.
|
||||
|
||||
## Compatibility
|
||||
|
||||
- The clip editor, image crop and App Mode were tested on ComfyUI 0.42.0 with frontend 1.55.18 and
|
||||
with frontend 1.57.1, including the light and dark palettes and narrow windows.
|
||||
|
||||
## Package links
|
||||
|
||||
- The package's repository, documentation, issue tracker and icon links now use the repository's
|
||||
current name, `MiniMaxH3-Studio`, so they no longer go through GitHub's redirect from the old name.
|
||||
The Comfy Registry name **ComfyUI-MiniMaxH3-Studio** is unchanged.
|
||||
|
||||
## Developer notes
|
||||
|
||||
- Browser tests model both side-panel layouts and both palette signals, and narrow and widen one
|
||||
page step by step instead of only loading it at each size. Unit tests cover both ways the host
|
||||
reports the mask editor and the node pack details in compiled workflows.
|
||||
|
||||
## Upgrade and limits
|
||||
|
||||
Replace the complete package, restart ComfyUI and refresh the browser. Project, settings and other
|
||||
public data formats are unchanged from 1.4.0. The supported FFmpeg build, platform requirements and
|
||||
storage requirements are unchanged.
|
||||
|
||||
---
|
||||
|
||||
# Release 1.4.0
|
||||
|
||||
## Clip editor transitions
|
||||
|
||||
@@ -137,7 +137,7 @@ if os.environ.get("H3_CONTEXT_HOST_SEQUENCE_CONTINUATION_CANARY") == "1":
|
||||
NODE_CLASS_MAPPINGS = {**NODE_CLASS_MAPPINGS, **CANARY_NODES}
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {**NODE_DISPLAY_NAME_MAPPINGS, **CANARY_DISPLAY_NAMES}
|
||||
|
||||
__version__ = "1.4.0"
|
||||
__version__ = "1.4.6"
|
||||
WEB_DIRECTORY = "web"
|
||||
|
||||
# CRITICAL: this bounded operator attempt runs after node registration. Its module owner survives
|
||||
|
||||
@@ -40,7 +40,7 @@ from .authoring_derivative_generator import (
|
||||
GeneratedAudioPreviewBody,
|
||||
GeneratedDerivativeBody,
|
||||
)
|
||||
from .authoring_fonts import AuthoringFontError, load_packaged_font_manifest
|
||||
from .authoring_fonts import AuthoringFontError, load_packaged_font_manifest, require_text_coverage
|
||||
from .authoring_generated_source import GeneratedAuthoringVideoSource
|
||||
from .authoring_image_source import OwnedImageSource
|
||||
from .authoring_render_source import PreparedAuthoringHistory
|
||||
@@ -119,23 +119,23 @@ class AuthoringDerivativeClaim:
|
||||
if self._asset.kind == "font":
|
||||
if clip is None or clip.text is None:
|
||||
raise MediaLeaseError("authority_mismatch")
|
||||
self._font = next(
|
||||
(
|
||||
face
|
||||
for face in history.fonts.faces
|
||||
if face.font_asset_id == self._asset.asset_id
|
||||
and face.weight == clip.text.weight
|
||||
and face.style == clip.text.style
|
||||
),
|
||||
None,
|
||||
)
|
||||
if self._font is None or not self._font.covers(clip.text.content):
|
||||
raise MediaLeaseError("unsupported")
|
||||
# IMPORTANT: preview must resolve the same whole-text fallback as final render;
|
||||
# selecting only the requested family refuses CJK or serves Latin bytes for it.
|
||||
try:
|
||||
self._font = require_text_coverage(
|
||||
history.fonts,
|
||||
self._asset.asset_id,
|
||||
clip.text.weight,
|
||||
clip.text.style,
|
||||
clip.text.content,
|
||||
)
|
||||
except AuthoringFontError:
|
||||
raise MediaLeaseError("unsupported") from None
|
||||
source_fingerprint = self._font.file_fingerprint
|
||||
generation = history.generation or 1
|
||||
generator_fingerprint = canonical_fingerprint(
|
||||
{
|
||||
"profile": "h3.authoring.packaged_ttf_identity.v1",
|
||||
"profile": "h3.authoring.packaged_font_identity.v1",
|
||||
"fontManifest": history.fonts.manifest_fingerprint,
|
||||
"fontPackage": history.fonts.package_fingerprint,
|
||||
"fontFace": self._font.file_fingerprint,
|
||||
@@ -522,6 +522,9 @@ class AuthoringDerivativeClaim:
|
||||
len(body),
|
||||
self._audio,
|
||||
geometry,
|
||||
media_type=("font/otf" if self._font.package_path.endswith(".otf") else "font/ttf")
|
||||
if self._font is not None
|
||||
else None,
|
||||
)
|
||||
completed, body = body, None
|
||||
return completed, verified
|
||||
|
||||
@@ -9,10 +9,12 @@ from __future__ import annotations
|
||||
import hashlib
|
||||
import json
|
||||
import struct
|
||||
import sys
|
||||
from collections.abc import Mapping, Sequence
|
||||
from dataclasses import dataclass, field
|
||||
from dataclasses import dataclass, field, fields, is_dataclass
|
||||
from pathlib import Path, PurePosixPath
|
||||
from typing import Final
|
||||
from threading import Lock
|
||||
from typing import Final, Literal
|
||||
|
||||
from ..core.canonical import canonical_fingerprint
|
||||
|
||||
@@ -27,11 +29,16 @@ _PUBLIC_STYLE_KEYS: Final = frozenset(
|
||||
)
|
||||
_LAYOUT_CODEPOINTS: Final = frozenset({0x09, 0x0A})
|
||||
_MAX_MANIFEST_BYTES: Final = 512 * 1024
|
||||
_MAX_FONT_BYTES: Final = 8 * 1024 * 1024
|
||||
_MAX_FONT_BYTES: Final = 12 * 1024 * 1024 # Largest pinned face: SC Bold, 8,543,168 bytes.
|
||||
_MAX_LICENSE_BYTES: Final = 64 * 1024
|
||||
_MAX_CODEPOINTS: Final = 65_536
|
||||
_MAX_RANGES: Final = 4_096
|
||||
_MAX_RANGES: Final = 8_192 # TC 2.004 has 5,055 disjoint coverage ranges.
|
||||
_MAX_CMAP_SEGMENTS: Final = 8_192 # KR 2.004 uses 4,656 format-4 segments.
|
||||
_HEX_SHA256_LENGTH: Final = 64
|
||||
_MAX_CACHED_FACES: Final = 12
|
||||
_MAX_CACHED_READS: Final = 19
|
||||
_MAX_CACHED_BYTES: Final = 32 * 1024 * 1024
|
||||
_MAX_CACHED_RECIPE_BYTES: Final = 64 * 1024
|
||||
|
||||
_ERROR_CODES: Final = frozenset(
|
||||
{
|
||||
@@ -43,6 +50,7 @@ _ERROR_CODES: Final = frozenset(
|
||||
"font_asset_unsupported",
|
||||
"font_style_unsupported",
|
||||
"font_glyph_unsupported",
|
||||
"font_italic_unsupported",
|
||||
}
|
||||
)
|
||||
|
||||
@@ -229,7 +237,9 @@ def _format4_codepoints(table: bytes) -> set[int]:
|
||||
struct.unpack_from(">H", table, 6)[0],
|
||||
)
|
||||
segment_count = segment_count_x2 // 2
|
||||
if segment_count_x2 % 2 or not 1 <= segment_count <= 4_096 or length > len(table):
|
||||
# IMPORTANT: valid regional CJK cmaps exceed 4,096 segments; retain the directory/byte
|
||||
# bounds as well as this measured cap, or either valid faces fail or malformed offsets escape.
|
||||
if segment_count_x2 % 2 or not 1 <= segment_count <= _MAX_CMAP_SEGMENTS or length > len(table):
|
||||
raise _fail("font_manifest_invalid", "a packaged font cmap format 4 is malformed")
|
||||
end_codes_offset = 14
|
||||
start_codes_offset = end_codes_offset + 2 * segment_count + 2
|
||||
@@ -401,14 +411,156 @@ class PackagedFontManifest:
|
||||
}
|
||||
|
||||
|
||||
def _load_packaged_font_manifest_from_root(package_root: Path) -> PackagedFontManifest:
|
||||
_relative_manifest_path, manifest_path = _safe_package_file(
|
||||
package_root,
|
||||
f"fonts/{FONT_MANIFEST_FILENAME}",
|
||||
missing_code="font_artifact_missing",
|
||||
_FontInputKind = Literal["manifest", "license", "font"]
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class _FontInputRead:
|
||||
package_path: str
|
||||
kind: _FontInputKind
|
||||
size_bytes: int
|
||||
fingerprint: str
|
||||
filesystem_path: Path = field(repr=False)
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class _FontDerivationEntry:
|
||||
package_root: Path = field(repr=False)
|
||||
reads: tuple[_FontInputRead, ...]
|
||||
manifest: PackagedFontManifest
|
||||
|
||||
|
||||
_FONT_DERIVATION_LOCK: Final = Lock()
|
||||
_font_derivation_entry: _FontDerivationEntry | None = None
|
||||
|
||||
|
||||
def _read_font_input(
|
||||
package_root: Path,
|
||||
package_path: object,
|
||||
kind: _FontInputKind,
|
||||
) -> tuple[_FontInputRead, bytes]:
|
||||
missing = "font_license_missing" if kind == "license" else "font_artifact_missing"
|
||||
relative, path = _safe_package_file(package_root, package_path, missing_code=missing)
|
||||
# Limits are live policy, not authority captured by an earlier successful cache fill.
|
||||
if kind == "manifest":
|
||||
maximum = _MAX_MANIFEST_BYTES
|
||||
elif kind == "license":
|
||||
maximum = _MAX_LICENSE_BYTES
|
||||
if not relative.endswith(".txt"):
|
||||
raise _fail("font_manifest_invalid", "the packaged font license artifact is invalid")
|
||||
else:
|
||||
maximum = _MAX_FONT_BYTES
|
||||
if not relative.endswith((".ttf", ".otf")):
|
||||
raise _fail("font_manifest_invalid", "only static packaged TTF/OTF faces are admitted")
|
||||
payload = _read_bounded(path, maximum, missing)
|
||||
return _FontInputRead(relative, kind, len(payload), _sha256(payload), path), payload
|
||||
|
||||
|
||||
def _retained_font_bytes(value: object, seen: set[int] | None = None) -> int:
|
||||
"""Account the known immutable cache graph, including Path's retained storage."""
|
||||
if seen is None:
|
||||
seen = set()
|
||||
identity = id(value)
|
||||
if identity in seen:
|
||||
return 0
|
||||
seen.add(identity)
|
||||
children: list[object] = []
|
||||
if isinstance(value, Path):
|
||||
# Materialize the lazy string/parts/hash caches before accounting their slot storage.
|
||||
str(value)
|
||||
hash(value)
|
||||
# CRITICAL: materialize lazy parts before slot accounting; removing this undercounts.
|
||||
_ = value.parts
|
||||
for cls in type(value).__mro__:
|
||||
for slot in getattr(cls, "__slots__", ()):
|
||||
if slot not in {"__weakref__", "__dict__"} and hasattr(value, slot):
|
||||
children.append(getattr(value, slot))
|
||||
elif is_dataclass(value) and not isinstance(value, type):
|
||||
children.extend(getattr(value, item.name) for item in fields(value))
|
||||
elif isinstance(value, (tuple, list, frozenset)):
|
||||
children.extend(value)
|
||||
return sys.getsizeof(value) + sum(_retained_font_bytes(child, seen) for child in children)
|
||||
|
||||
|
||||
def _font_entry_is_cacheable(entry: _FontDerivationEntry) -> bool:
|
||||
return (
|
||||
len(entry.manifest.faces) <= _MAX_CACHED_FACES
|
||||
and len(entry.reads) <= _MAX_CACHED_READS
|
||||
and _retained_font_bytes(entry.reads) <= _MAX_CACHED_RECIPE_BYTES
|
||||
and _retained_font_bytes(entry) <= _MAX_CACHED_BYTES
|
||||
)
|
||||
|
||||
|
||||
def packaged_manifest_fingerprint(decoded: object) -> str:
|
||||
"""Hash the closed font wire after its own resource validation.
|
||||
|
||||
Coverage has thousands of ranges; the general 256-item canonicalizer is not this format's
|
||||
resource authority. Keep deterministic JSON without widening any general canonical bounds.
|
||||
"""
|
||||
return _sha256(
|
||||
json.dumps(
|
||||
decoded, sort_keys=True, ensure_ascii=False, allow_nan=False, separators=(",", ":")
|
||||
).encode("utf-8")
|
||||
)
|
||||
|
||||
|
||||
def _verified_license(
|
||||
package_root: Path,
|
||||
raw: object,
|
||||
revision: str,
|
||||
copyright_line: bytes,
|
||||
reads: list[_FontInputRead],
|
||||
) -> str:
|
||||
wire = _mapping(raw, ("spdx_id", "package_path", "file_sha256", "upstream_revision"), "license")
|
||||
if (
|
||||
wire["spdx_id"] != "OFL-1.1"
|
||||
or _git_oid(wire["upstream_revision"], "license revision") != revision
|
||||
):
|
||||
raise _fail("font_manifest_invalid", "the font build and license revisions differ")
|
||||
observed, payload = _read_font_input(package_root, wire["package_path"], "license")
|
||||
reads.append(observed)
|
||||
expected = _sha256_value(wire["file_sha256"], "license.file_sha256")
|
||||
# CRITICAL: accept only Git's CRLF -> LF text conversion; broader cleanup conceals tampering.
|
||||
if _sha256(payload.replace(b"\r\n", b"\n")) != expected:
|
||||
raise _fail("font_license_hash_mismatch", "the packaged font license hash differs")
|
||||
if b"SIL OPEN FONT LICENSE Version 1.1" not in payload or copyright_line not in payload:
|
||||
raise _fail("font_manifest_invalid", "the packaged font license content is unsupported")
|
||||
return expected
|
||||
|
||||
|
||||
def _load_packaged_font_manifest_from_root(package_root: Path) -> PackagedFontManifest:
|
||||
global _font_derivation_entry
|
||||
manifest_read, payload = _read_font_input(
|
||||
package_root, f"fonts/{FONT_MANIFEST_FILENAME}", "manifest"
|
||||
)
|
||||
# The fixed manifest location is exactly fonts/<filename> under the guarded resolved root.
|
||||
resolved_root = manifest_read.filesystem_path.parent.parent
|
||||
with _FONT_DERIVATION_LOCK:
|
||||
entry = _font_derivation_entry
|
||||
if (
|
||||
entry is not None
|
||||
and entry.package_root == resolved_root
|
||||
and entry.reads[0] == manifest_read
|
||||
):
|
||||
try:
|
||||
matches = True
|
||||
for previous in entry.reads[1:]:
|
||||
current, _payload = _read_font_input(
|
||||
package_root, previous.package_path, previous.kind
|
||||
)
|
||||
if current != previous:
|
||||
matches = False
|
||||
break
|
||||
except AuthoringFontError:
|
||||
matches = False
|
||||
if matches:
|
||||
# CRITICAL: reuse only after fresh guarded reads and actual SHA256 of EVERY input
|
||||
# on the same resolved root; stat-only checks accept same-stat tampering. Git OIDs
|
||||
# reuse only the derivation verified on those same SHA256 bytes. This shared result
|
||||
# must stay deeply immutable, or one caller can change every later admission's fonts.
|
||||
return entry.manifest
|
||||
reads = [manifest_read]
|
||||
try:
|
||||
payload = _read_bounded(manifest_path, _MAX_MANIFEST_BYTES, "font_artifact_missing")
|
||||
decoded = json.loads(payload)
|
||||
except AuthoringFontError:
|
||||
raise
|
||||
@@ -439,18 +591,16 @@ def _load_packaged_font_manifest_from_root(package_root: Path) -> PackagedFontMa
|
||||
)
|
||||
if license_wire["spdx_id"] != "OFL-1.1":
|
||||
raise _fail("font_manifest_invalid", "the packaged font license is unsupported")
|
||||
license_path_value, license_path = _safe_package_file(
|
||||
package_root, license_wire["package_path"], missing_code="font_license_missing"
|
||||
license_read, license_payload = _read_font_input(
|
||||
package_root, license_wire["package_path"], "license"
|
||||
)
|
||||
if not license_path_value.endswith(".txt"):
|
||||
raise _fail("font_manifest_invalid", "the packaged font license artifact is invalid")
|
||||
license_payload = _read_bounded(license_path, _MAX_LICENSE_BYTES, "font_license_missing")
|
||||
reads.append(license_read)
|
||||
license_hash = _sha256_value(license_wire["file_sha256"], "license.file_sha256")
|
||||
# CRITICAL: Git for Windows can check these bounded text bytes out as CRLF. Hash only
|
||||
# CRLF -> LF equivalence; raw hashes reject valid installs, broader cleanup hides tampering.
|
||||
if _sha256(license_payload.replace(b"\r\n", b"\n")) != license_hash:
|
||||
raise _fail("font_license_hash_mismatch", "the packaged font license hash differs")
|
||||
license_revision = _git_oid(license_wire["upstream_revision"], "license.upstream_revision")
|
||||
_git_oid(license_wire["upstream_revision"], "license.upstream_revision")
|
||||
if (
|
||||
b"SIL OPEN FONT LICENSE Version 1.1" not in license_payload
|
||||
or b"Copyright 2022 The Noto Project Authors" not in license_payload
|
||||
@@ -502,8 +652,8 @@ def _load_packaged_font_manifest_from_root(package_root: Path) -> PackagedFontMa
|
||||
face_ids_seen: set[str] = set()
|
||||
style_keys_seen: set[tuple[str, int, str]] = set()
|
||||
raw_assets = _array(root["font_assets"], "font_assets", maximum=16)
|
||||
if len(raw_assets) != 1:
|
||||
raise _fail("font_manifest_invalid", "the v1 font profile requires exactly one font asset")
|
||||
declared_styles: dict[str, set[tuple[int, str]]] = {}
|
||||
license_hashes: list[str] = []
|
||||
for asset_index, raw_asset in enumerate(raw_assets):
|
||||
asset = _mapping(
|
||||
raw_asset,
|
||||
@@ -514,6 +664,9 @@ def _load_packaged_font_manifest_from_root(package_root: Path) -> PackagedFontMa
|
||||
"build_revision",
|
||||
"distribution_revision",
|
||||
"faces",
|
||||
"supported_styles",
|
||||
"license",
|
||||
"source_repository",
|
||||
),
|
||||
f"font_assets[{asset_index}]",
|
||||
)
|
||||
@@ -525,8 +678,32 @@ def _load_packaged_font_manifest_from_root(package_root: Path) -> PackagedFontMa
|
||||
_string(asset["release_id"], "release_id")
|
||||
build_revision = _git_oid(asset["build_revision"], "build_revision")
|
||||
_git_oid(asset["distribution_revision"], "distribution_revision")
|
||||
if build_revision != license_revision:
|
||||
raise _fail("font_manifest_invalid", "the font build and license revisions differ")
|
||||
# Keep the legacy top-level license bound to the primary family as before.
|
||||
if asset_index == 0 and asset["license"] != license_wire:
|
||||
raise _fail("font_manifest_invalid", "the primary and legacy licenses differ")
|
||||
repository = _string(asset["source_repository"], "source_repository")
|
||||
copyright_line = {
|
||||
"notofonts/latin-greek-cyrillic": b"Copyright 2022 The Noto Project Authors",
|
||||
"notofonts/noto-cjk": "© 2014-2021 Adobe (http://www.adobe.com/).".encode(),
|
||||
}.get(repository)
|
||||
if copyright_line is None:
|
||||
raise _fail("font_manifest_invalid", "the packaged font source is unsupported")
|
||||
license_hashes.append(
|
||||
_verified_license(package_root, asset["license"], build_revision, copyright_line, reads)
|
||||
)
|
||||
styles: set[tuple[int, str]] = set()
|
||||
for raw_style in _array(asset["supported_styles"], "supported_styles", maximum=4):
|
||||
declared_style = _mapping(raw_style, ("weight", "style"), "supported style")
|
||||
key = (
|
||||
_integer(declared_style["weight"], "weight", 400, 700),
|
||||
_string(declared_style["style"], "style"),
|
||||
)
|
||||
if key not in _PUBLIC_STYLE_KEYS or key in styles:
|
||||
raise _fail(
|
||||
"font_manifest_invalid", "supported styles must be unique public styles"
|
||||
)
|
||||
styles.add(key)
|
||||
declared_styles[asset_id] = styles
|
||||
for face_index, raw_face in enumerate(_array(asset["faces"], "faces", maximum=16)):
|
||||
face = _mapping(
|
||||
raw_face,
|
||||
@@ -560,15 +737,12 @@ def _load_packaged_font_manifest_from_root(package_root: Path) -> PackagedFontMa
|
||||
if style_key in style_keys_seen:
|
||||
raise _fail("font_manifest_invalid", "font face styles must be unique per asset")
|
||||
style_keys_seen.add(style_key)
|
||||
package_path_value, font_path = _safe_package_file(
|
||||
package_root, face["package_path"], missing_code="font_artifact_missing"
|
||||
)
|
||||
if not package_path_value.endswith(".ttf"):
|
||||
raise _fail("font_manifest_invalid", "only static packaged TTF faces are admitted")
|
||||
font_payload = _read_bounded(font_path, _MAX_FONT_BYTES, "font_artifact_missing")
|
||||
font_read, font_payload = _read_font_input(package_root, face["package_path"], "font")
|
||||
reads.append(font_read)
|
||||
package_path_value, font_path = font_read.package_path, font_read.filesystem_path
|
||||
expected_size = _integer(face["size_bytes"], "size_bytes", 1, _MAX_FONT_BYTES)
|
||||
expected_hash = _sha256_value(face["file_sha256"], "file_sha256")
|
||||
if len(font_payload) != expected_size or _sha256(font_payload) != expected_hash:
|
||||
if len(font_payload) != expected_size or font_read.fingerprint != expected_hash:
|
||||
raise _fail(
|
||||
"font_artifact_hash_mismatch", "a packaged font differs from its manifest"
|
||||
)
|
||||
@@ -625,10 +799,10 @@ def _load_packaged_font_manifest_from_root(package_root: Path) -> PackagedFontMa
|
||||
actual_styles = {
|
||||
(face.weight, face.style) for face in faces if face.font_asset_id == asset_id
|
||||
}
|
||||
if actual_styles != _PUBLIC_STYLE_KEYS:
|
||||
if actual_styles != declared_styles[asset_id]:
|
||||
raise _fail(
|
||||
"font_manifest_invalid",
|
||||
"each v1 font asset must cover the exact public weight/style vocabulary",
|
||||
"each font asset must cover exactly its declared public styles",
|
||||
)
|
||||
|
||||
fallback_raw = _array(root["fallback_order"], "fallback_order", maximum=16)
|
||||
@@ -647,6 +821,7 @@ def _load_packaged_font_manifest_from_root(package_root: Path) -> PackagedFontMa
|
||||
# Keep the package identity stable across Git's text checkout conversion, as above.
|
||||
"manifest_sha256": _sha256(payload.replace(b"\r\n", b"\n")),
|
||||
"license_sha256": license_hash,
|
||||
"asset_license_sha256": license_hashes,
|
||||
"font_files": [
|
||||
{
|
||||
"artifact_id": face.artifact_id,
|
||||
@@ -658,16 +833,21 @@ def _load_packaged_font_manifest_from_root(package_root: Path) -> PackagedFontMa
|
||||
],
|
||||
}
|
||||
)
|
||||
return PackagedFontManifest(
|
||||
manifest = PackagedFontManifest(
|
||||
schema_version=FONT_MANIFEST_SCHEMA,
|
||||
profile_id=FONT_MANIFEST_PROFILE_ID,
|
||||
fallback_order=fallback_order,
|
||||
faces=tuple(faces),
|
||||
license_spdx_id="OFL-1.1",
|
||||
license_file_fingerprint=license_hash,
|
||||
manifest_fingerprint=canonical_fingerprint(decoded),
|
||||
manifest_fingerprint=packaged_manifest_fingerprint(decoded),
|
||||
package_fingerprint=package_fingerprint,
|
||||
)
|
||||
candidate = _FontDerivationEntry(resolved_root, tuple(reads), manifest)
|
||||
if _font_entry_is_cacheable(candidate):
|
||||
with _FONT_DERIVATION_LOCK:
|
||||
_font_derivation_entry = candidate
|
||||
return manifest
|
||||
|
||||
|
||||
def load_packaged_font_manifest() -> PackagedFontManifest:
|
||||
@@ -704,11 +884,38 @@ def require_text_coverage(
|
||||
|
||||
if not isinstance(text, str) or not text:
|
||||
raise _fail("font_glyph_unsupported", "text must be a non-empty string")
|
||||
primary = resolve_packaged_font(manifest, font_asset_id, weight, style)
|
||||
candidates = [primary]
|
||||
for fallback_id in manifest.fallback_order:
|
||||
if fallback_id == font_asset_id:
|
||||
continue
|
||||
if font_asset_id not in manifest.fallback_order:
|
||||
raise _fail("font_asset_unsupported", "the requested font asset is not packaged")
|
||||
if weight not in _PUBLIC_WEIGHTS or style not in _PUBLIC_STYLES:
|
||||
raise _fail("font_style_unsupported", "the requested font style is not packaged")
|
||||
# IMPORTANT: regional faces share kana/Hangul coverage but have different default glyph
|
||||
# forms. Coverage alone chooses TC for Japanese/Korean; match this order in the browser.
|
||||
preferred = (
|
||||
"h3.font.noto_sans_jp.v1"
|
||||
if any(
|
||||
0x3040 <= ord(ch) <= 0x30FF
|
||||
or 0x31F0 <= ord(ch) <= 0x31FF
|
||||
or 0xFF66 <= ord(ch) <= 0xFF9D
|
||||
for ch in text
|
||||
)
|
||||
else "h3.font.noto_sans_kr.v1"
|
||||
if any(
|
||||
0x1100 <= ord(ch) <= 0x11FF
|
||||
or 0x3130 <= ord(ch) <= 0x318F
|
||||
or 0xA960 <= ord(ch) <= 0xA97F
|
||||
or 0xAC00 <= ord(ch) <= 0xD7FF
|
||||
or 0xFFA0 <= ord(ch) <= 0xFFDC
|
||||
for ch in text
|
||||
)
|
||||
else None
|
||||
)
|
||||
order = list(
|
||||
dict.fromkeys(
|
||||
[font_asset_id, *([preferred] if preferred else []), *manifest.fallback_order]
|
||||
)
|
||||
)
|
||||
candidates = []
|
||||
for fallback_id in order:
|
||||
try:
|
||||
candidates.append(resolve_packaged_font(manifest, fallback_id, weight, style))
|
||||
except AuthoringFontError as exc:
|
||||
@@ -717,6 +924,15 @@ def require_text_coverage(
|
||||
for candidate in candidates:
|
||||
if candidate.covers(text):
|
||||
return candidate
|
||||
if style == "italic":
|
||||
try:
|
||||
require_text_coverage(manifest, font_asset_id, weight, "normal", text)
|
||||
except AuthoringFontError:
|
||||
pass
|
||||
else:
|
||||
raise _fail(
|
||||
"font_italic_unsupported", "this text is covered only by upright packaged faces"
|
||||
)
|
||||
missing = sorted(
|
||||
{
|
||||
ord(character)
|
||||
|
||||
@@ -443,7 +443,7 @@ class MediaLeaseAuthority:
|
||||
"runtimeEpoch": entry.runtime_epoch,
|
||||
"ttlMs": max(0, min(60_000, int((entry.expires - self._clock()) * 1000))),
|
||||
"derivativeKind": facts.kind,
|
||||
"mediaType": derivative_media_type(facts.kind),
|
||||
"mediaType": facts.media_type or derivative_media_type(facts.kind),
|
||||
"byteCount": facts.byte_count,
|
||||
"derivativeFingerprint": facts.derivative.derivative_fingerprint,
|
||||
"profileFingerprint": RUNTIME_PROFILE_FINGERPRINT,
|
||||
|
||||
@@ -428,7 +428,13 @@ class AuthoringOutputRegistry:
|
||||
except RenderServiceError as exc:
|
||||
code = (
|
||||
exc.code
|
||||
if exc.code in {"resource_limit", "idempotency_conflict", "runtime_unavailable"}
|
||||
if exc.code
|
||||
in {
|
||||
"resource_limit",
|
||||
"idempotency_conflict",
|
||||
"runtime_unavailable",
|
||||
"path_too_deep",
|
||||
}
|
||||
else "unavailable"
|
||||
)
|
||||
raise OutputProtocolError(code) from None
|
||||
|
||||
@@ -16,7 +16,7 @@ from typing import NoReturn, SupportsIndex
|
||||
from ..core.authoring_render_jobs import render_plan_fingerprint
|
||||
from ..core.composition_contract import TextStyle
|
||||
from ..core.render_planner import RenderPlanV1
|
||||
from ..core.safe_paths import UnsafePathError, validate_regular_file
|
||||
from ..core.safe_paths import UnsafePathError, _native_io_path, validate_regular_file
|
||||
from .authoring_fonts import AuthoringFontError, PackagedFontManifest, require_text_coverage
|
||||
from .authoring_image_source import IMAGE_SOURCE_PROFILE
|
||||
from .authoring_render_leases import AuthoringRenderJobSources
|
||||
@@ -72,8 +72,10 @@ def _pin_stage_inputs(
|
||||
# CRITICAL: read-only sharing denies writes and replacement until encoding
|
||||
# ends; a size/mtime recheck cannot detect same-stat content substitution.
|
||||
kernel = _kernel()
|
||||
# IMPORTANT: validators retain logical paths; convert at each native pin and
|
||||
# metadata boundary or long staged inputs fail even after validation.
|
||||
handle = kernel.CreateFileW(
|
||||
str(admitted), 0x80000000, 0x1, None, 3, 0x00200080, None
|
||||
str(_native_io_path(admitted)), 0x80000000, 0x1, None, 3, 0x00200080, None
|
||||
)
|
||||
if not handle or handle == ctypes.c_void_p(-1).value:
|
||||
raise RenderPreparationError("source_invalid")
|
||||
@@ -86,7 +88,7 @@ def _pin_stage_inputs(
|
||||
raise
|
||||
scope.callback(os.close, descriptor)
|
||||
metadata = os.fstat(descriptor)
|
||||
expected = admitted.lstat()
|
||||
expected = _native_io_path(admitted).lstat()
|
||||
if metadata.st_nlink != 1 or (
|
||||
metadata.st_dev,
|
||||
metadata.st_ino,
|
||||
@@ -379,7 +381,8 @@ def run_prepared_render(
|
||||
raise RenderPreparationError("plan_mismatch")
|
||||
program = build_render_graph(plan=plan, prepared=prepared)
|
||||
stage = prepared._stage
|
||||
if stage.output_path.exists():
|
||||
# IMPORTANT: stage locators stay logical; their filesystem checks need native spelling.
|
||||
if _native_io_path(stage.output_path).exists():
|
||||
raise RenderProcessError("process_failed")
|
||||
graph_bytes = program.filter_graph.encode("utf-8")
|
||||
graph_path = stage.write_input(graph_bytes, suffix=".ffgraph")
|
||||
@@ -413,7 +416,8 @@ def run_prepared_render(
|
||||
output = validate_regular_file(
|
||||
stage.output_path, maximum_bytes=stage._store._limits.max_output_bytes
|
||||
)
|
||||
if output.stat().st_size == 0 or output.stat().st_nlink != 1:
|
||||
metadata = _native_io_path(output).stat()
|
||||
if metadata.st_size == 0 or metadata.st_nlink != 1:
|
||||
raise RenderProcessError("process_failed")
|
||||
except (OSError, UnsafePathError):
|
||||
raise RenderProcessError("process_failed") from None
|
||||
|
||||
@@ -20,7 +20,7 @@ from typing import Any
|
||||
|
||||
from ..core.authoring_render_jobs import RenderJobLimits
|
||||
from ..core.authoring_render_receipts import MeasuredRenderOutput, render_video_timing_fingerprint
|
||||
from ..core.safe_paths import validate_regular_file
|
||||
from ..core.safe_paths import _native_io_path, validate_regular_file
|
||||
from .authoring_render_process import (
|
||||
PinnedRenderExecutable,
|
||||
ProcessControl,
|
||||
@@ -370,7 +370,11 @@ def measure_render_output(
|
||||
kernel = _kernel()
|
||||
# CRITICAL: keep the output deny-write/delete handle through all decoder passes.
|
||||
# Rechecking size/mtime after separate opens misses same-stat replacement races.
|
||||
handle = kernel.CreateFileW(str(admitted), 0x80000000, 0x1, None, 3, 0x00200080, None)
|
||||
# IMPORTANT: validation returns a logical locator, not a native long-path operand.
|
||||
# Keep child protocol arguments logical while converting every filesystem check.
|
||||
handle = kernel.CreateFileW(
|
||||
str(_native_io_path(admitted)), 0x80000000, 0x1, None, 3, 0x00200080, None
|
||||
)
|
||||
if not handle or handle == ctypes.c_void_p(-1).value:
|
||||
raise RenderProbeError()
|
||||
try:
|
||||
@@ -382,7 +386,7 @@ def measure_render_output(
|
||||
raise
|
||||
scope.callback(os.close, descriptor)
|
||||
metadata = os.fstat(descriptor)
|
||||
expected = admitted.lstat()
|
||||
expected = _native_io_path(admitted).lstat()
|
||||
identity = (metadata.st_dev, metadata.st_ino, metadata.st_size)
|
||||
if (
|
||||
identity != (expected.st_dev, expected.st_ino, expected.st_size)
|
||||
@@ -460,7 +464,9 @@ def measure_render_output(
|
||||
)
|
||||
if fingerprint() != before:
|
||||
raise RenderProbeError()
|
||||
current = validate_regular_file(admitted, maximum_bytes=limits.max_output_bytes).lstat()
|
||||
current = _native_io_path(
|
||||
validate_regular_file(admitted, maximum_bytes=limits.max_output_bytes)
|
||||
).lstat()
|
||||
if (current.st_dev, current.st_ino, current.st_size) != identity:
|
||||
raise RenderProbeError()
|
||||
_guard(control)
|
||||
|
||||
@@ -23,7 +23,7 @@ from pathlib import Path
|
||||
from typing import Any, NoReturn, Protocol, SupportsIndex
|
||||
|
||||
from ..core.authoring_render_jobs import RenderJobLimits
|
||||
from ..core.safe_paths import validate_directory, validate_regular_file
|
||||
from ..core.safe_paths import _native_io_path, validate_directory, validate_regular_file
|
||||
from .segment_artifact_store import (
|
||||
_msvcrt_get_osfhandle,
|
||||
_msvcrt_open_osfhandle,
|
||||
@@ -263,8 +263,10 @@ class PinnedRenderExecutable:
|
||||
with self._lock:
|
||||
if self._closed:
|
||||
raise RenderProcessError("runtime_unavailable")
|
||||
metadata = validate_regular_file(
|
||||
self._path, maximum_bytes=_MAX_EXECUTABLE_BYTES
|
||||
# IMPORTANT: executable identity stays logical; a native metadata operand must
|
||||
# be converted again after validation or long executable pins cannot be borrowed.
|
||||
metadata = _native_io_path(
|
||||
validate_regular_file(self._path, maximum_bytes=_MAX_EXECUTABLE_BYTES)
|
||||
).lstat()
|
||||
if (metadata.st_dev, metadata.st_ino, metadata.st_size) != self._identity:
|
||||
raise RenderProcessError("runtime_unavailable")
|
||||
@@ -309,7 +311,11 @@ def pin_render_executable(
|
||||
kernel = _kernel()
|
||||
# CRITICAL: keep deny-write/delete handles through every child run. A hash followed
|
||||
# by an ordinary reopen lets an executable change between admission and CreateProcess.
|
||||
handle = kernel.CreateFileW(str(admitted), 0x80000000, 0x1, None, 3, 0x00200080, None)
|
||||
# IMPORTANT: this file pin accepts extended paths; CreateProcessW app/cwd below do not.
|
||||
# Do not propagate this native spelling into the executable's logical identity.
|
||||
handle = kernel.CreateFileW(
|
||||
str(_native_io_path(admitted)), 0x80000000, 0x1, None, 3, 0x00200080, None
|
||||
)
|
||||
if not handle or handle == ctypes.c_void_p(-1).value:
|
||||
raise RenderProcessError("runtime_unavailable")
|
||||
try:
|
||||
@@ -321,7 +327,7 @@ def pin_render_executable(
|
||||
raise
|
||||
scope.callback(os.close, descriptor)
|
||||
opened = os.fstat(descriptor)
|
||||
before = admitted.lstat()
|
||||
before = _native_io_path(admitted).lstat()
|
||||
if (opened.st_dev, opened.st_ino, opened.st_size) != (
|
||||
before.st_dev,
|
||||
before.st_ino,
|
||||
|
||||
@@ -64,6 +64,7 @@ class RenderServiceError(RuntimeError):
|
||||
"job_unavailable",
|
||||
"output_unavailable",
|
||||
"runtime_unavailable",
|
||||
"path_too_deep",
|
||||
"resource_limit",
|
||||
"service_closed",
|
||||
"source_unavailable",
|
||||
@@ -292,6 +293,10 @@ class AuthoringRenderService:
|
||||
replay = self._replay(request)
|
||||
if replay is not None:
|
||||
return replay
|
||||
# IMPORTANT: reject the child's measured path limit before qualification, source
|
||||
# acquisition or staging; a late child failure obscures this actionable cause.
|
||||
if not self._store.native_render_path_supported:
|
||||
raise RenderServiceError(RenderJobFailure.PATH_TOO_DEEP.value)
|
||||
self._capacity(request)
|
||||
if self._admissions >= self._limits.queue_depth:
|
||||
raise RenderServiceError("resource_limit")
|
||||
|
||||
@@ -488,6 +488,38 @@ class BoundAuthoringRenderPlan(_OpaqueClaim):
|
||||
return confirmation
|
||||
|
||||
|
||||
def _require_resolved_font_bindings(
|
||||
snapshot: PublicCompositionSnapshot,
|
||||
fonts: PackagedFontManifest,
|
||||
facts: PackagedFontFacts,
|
||||
) -> None:
|
||||
# CRITICAL: package membership alone admits wrong regional glyphs. Check the exact
|
||||
# deterministic resolved face before planning; requested and resolved ids may differ.
|
||||
clips = {clip.clip_id: clip for clip in snapshot.clips}
|
||||
identity_fields = (
|
||||
"font_asset_id",
|
||||
"artifact_id",
|
||||
"weight",
|
||||
"style",
|
||||
"file_fingerprint",
|
||||
"cmap_fingerprint",
|
||||
"build_version",
|
||||
)
|
||||
for binding in facts.title_bindings:
|
||||
clip = clips.get(binding.clip_id)
|
||||
if clip is None or clip.text is None:
|
||||
raise AuthoringSourceBindingError("font_glyph_unsupported")
|
||||
text = clip.text
|
||||
try:
|
||||
expected = require_text_coverage(
|
||||
fonts, text.font_asset_id, text.weight, text.style, text.content
|
||||
)
|
||||
except AuthoringFontError as exc:
|
||||
raise AuthoringSourceBindingError(exc.code) from None
|
||||
if any(getattr(binding, field) != getattr(expected, field) for field in identity_fields):
|
||||
raise AuthoringSourceBindingError("font_glyph_unsupported")
|
||||
|
||||
|
||||
def prepare_bound_render_plan(
|
||||
history: PreparedAuthoringHistory,
|
||||
snapshot: PublicCompositionSnapshot,
|
||||
@@ -610,6 +642,7 @@ def prepare_bound_render_plan(
|
||||
facts_fingerprint="sha256:" + "0" * 64,
|
||||
)
|
||||
font_facts = replace(font_facts, facts_fingerprint=packaged_font_facts_fingerprint(font_facts))
|
||||
_require_resolved_font_bindings(snapshot, fonts, font_facts)
|
||||
plan = plan_render(
|
||||
snapshot=snapshot, source_manifest=manifest, currentness=confirmation, font_facts=font_facts
|
||||
)
|
||||
|
||||
@@ -22,7 +22,12 @@ from typing import NoReturn, SupportsIndex
|
||||
from ..core.authoring_render_jobs import RenderJobLimits
|
||||
from ..core.authoring_render_receipts import AuthoringRenderReceiptV1, MeasuredRenderOutput
|
||||
from ..core.canonical import canonical_bytes
|
||||
from ..core.safe_paths import UnsafePathError, validate_directory, validate_regular_file
|
||||
from ..core.safe_paths import (
|
||||
UnsafePathError,
|
||||
_native_io_path,
|
||||
validate_directory,
|
||||
validate_regular_file,
|
||||
)
|
||||
from .segment_artifact_store import (
|
||||
ArtifactStoreError,
|
||||
_read_regular_bytes,
|
||||
@@ -63,14 +68,60 @@ class RenderStoreError(RuntimeError):
|
||||
super().__init__(code)
|
||||
|
||||
|
||||
class _CleanupCause(Exception):
|
||||
def __init__(self, category: str, errno: int | None, winerror: int | None) -> None:
|
||||
self.category = category
|
||||
self.errno = errno
|
||||
self.winerror = winerror
|
||||
super().__init__(category, errno, winerror)
|
||||
|
||||
|
||||
def _cleanup_cause(error: BaseException) -> _CleanupCause:
|
||||
category = "cleanup_error"
|
||||
for _ in range(8):
|
||||
for kind in (
|
||||
PermissionError,
|
||||
FileNotFoundError,
|
||||
OSError,
|
||||
UnsafePathError,
|
||||
ArtifactStoreError,
|
||||
):
|
||||
if isinstance(error, kind):
|
||||
category = kind.__name__
|
||||
break
|
||||
if isinstance(error, OSError):
|
||||
number = error.errno
|
||||
winerror = getattr(error, "winerror", None)
|
||||
return _CleanupCause(
|
||||
category,
|
||||
number if type(number) is int else None,
|
||||
winerror if type(winerror) is int else None,
|
||||
)
|
||||
following = error.__cause__ or error.__context__
|
||||
if following is None:
|
||||
break
|
||||
error = following
|
||||
return _CleanupCause(category, None, None)
|
||||
|
||||
|
||||
def _raise_cleanup_failure(cause: _CleanupCause) -> NoReturn:
|
||||
try:
|
||||
raise RenderStoreError("cleanup_failed") from cause
|
||||
except RenderStoreError as failure:
|
||||
# CRITICAL: from None only hides context in formatting. Detach it even during rollback
|
||||
# inside another exception handler, or filename-bearing OS errors remain reachable.
|
||||
failure.__context__ = None
|
||||
raise
|
||||
|
||||
|
||||
def _directory_identity(path: Path) -> tuple[int, int]:
|
||||
metadata = validate_directory(path).lstat()
|
||||
metadata = _native_io_path(validate_directory(path)).lstat()
|
||||
return metadata.st_dev, metadata.st_ino
|
||||
|
||||
|
||||
def _file_names(directory: Path, maximum: int) -> tuple[str, ...]:
|
||||
names: list[str] = []
|
||||
with os.scandir(directory) as entries:
|
||||
with os.scandir(_native_io_path(directory)) as entries:
|
||||
for entry in entries:
|
||||
if len(names) >= maximum:
|
||||
raise RenderStoreError("resource_limit")
|
||||
@@ -92,20 +143,21 @@ def _remove_directory(path: Path, identity: tuple[int, int]) -> None:
|
||||
raise RenderStoreError("unsafe_store")
|
||||
for name in names:
|
||||
entry = validate_regular_file(path / name)
|
||||
if entry.lstat().st_nlink != 1:
|
||||
if _native_io_path(entry).lstat().st_nlink != 1:
|
||||
raise RenderStoreError("unsafe_store")
|
||||
for name in names:
|
||||
validate_regular_file(path / name).unlink()
|
||||
_native_io_path(validate_regular_file(path / name)).unlink()
|
||||
if _directory_identity(path) != identity:
|
||||
raise RenderStoreError("unsafe_store")
|
||||
path.rmdir()
|
||||
_native_io_path(path).rmdir()
|
||||
|
||||
|
||||
def _lock_marker(path: Path) -> int:
|
||||
admitted = validate_regular_file(path, maximum_bytes=1024)
|
||||
before = admitted.lstat()
|
||||
before = _native_io_path(admitted).lstat()
|
||||
descriptor = os.open(
|
||||
admitted, os.O_RDWR | getattr(os, "O_BINARY", 0) | getattr(os, "O_NOFOLLOW", 0)
|
||||
_native_io_path(admitted),
|
||||
os.O_RDWR | getattr(os, "O_BINARY", 0) | getattr(os, "O_NOFOLLOW", 0),
|
||||
)
|
||||
try:
|
||||
opened = os.fstat(descriptor)
|
||||
@@ -157,8 +209,8 @@ def _recover_orphans(root: Path) -> None:
|
||||
os.close(descriptor)
|
||||
if _directory_identity(session) != identity:
|
||||
raise RenderStoreError("unsafe_store")
|
||||
validate_regular_file(marker, maximum_bytes=1024).unlink()
|
||||
session.rmdir()
|
||||
_native_io_path(validate_regular_file(marker, maximum_bytes=1024)).unlink()
|
||||
_native_io_path(session).rmdir()
|
||||
|
||||
|
||||
class RenderStage:
|
||||
@@ -223,7 +275,7 @@ class RenderStage:
|
||||
if name not in self._files:
|
||||
raise RenderStoreError("unsafe_store")
|
||||
path = validate_regular_file(self._directory / name)
|
||||
metadata = path.lstat()
|
||||
metadata = _native_io_path(path).lstat()
|
||||
if metadata.st_nlink != 1:
|
||||
raise RenderStoreError("unsafe_store")
|
||||
total += metadata.st_size
|
||||
@@ -275,7 +327,7 @@ class RenderOutputStore:
|
||||
with _validated_directories(self._root):
|
||||
_recover_orphans(self._root)
|
||||
self._session = self._root / ("h3-render-" + uuid.uuid4().hex)
|
||||
self._session.mkdir(mode=0o700)
|
||||
_native_io_path(self._session).mkdir(mode=0o700)
|
||||
self._session_identity = _directory_identity(self._session)
|
||||
marker = self._session / "owner.json"
|
||||
_write_new_file(
|
||||
@@ -286,6 +338,21 @@ class RenderOutputStore:
|
||||
except (OSError, ValueError, ArtifactStoreError):
|
||||
raise RenderStoreError("store_unavailable") from None
|
||||
|
||||
@property
|
||||
def native_render_path_supported(self) -> bool:
|
||||
if sys.platform != "win32":
|
||||
return True
|
||||
longest = self._session / ("stage-" + "0" * 32) / ("0" * 32 + max(_SUFFIXES, key=len))
|
||||
ordinary = str(longest)
|
||||
if ordinary.startswith("\\\\?\\UNC\\"):
|
||||
ordinary = "\\\\" + ordinary[8:]
|
||||
elif ordinary.startswith("\\\\?\\"):
|
||||
ordinary = ordinary[4:]
|
||||
# IMPORTANT: measured child capability is 259 UTF-16 units, independent of registry
|
||||
# policy. REPORT-069 found cwd error 267; R374 also failed relative opens past MAX_PATH.
|
||||
# Generic store operations still support long paths; refuse only native render admission.
|
||||
return len(ordinary.encode("utf-16-le")) // 2 <= 259
|
||||
|
||||
@property
|
||||
def staging_count(self) -> int:
|
||||
with self._lock:
|
||||
@@ -327,7 +394,7 @@ class RenderOutputStore:
|
||||
raise RenderStoreError("resource_limit")
|
||||
with _validated_directories(self._root, self._session):
|
||||
directory = self._session / ("stage-" + uuid.uuid4().hex)
|
||||
directory.mkdir(mode=0o700)
|
||||
_native_io_path(directory).mkdir(mode=0o700)
|
||||
stage = RenderStage(self, job_id, request_fingerprint, directory)
|
||||
self._stages[job_id] = stage
|
||||
return stage
|
||||
@@ -337,11 +404,14 @@ class RenderOutputStore:
|
||||
if self._stages.get(stage.job_id) is not stage:
|
||||
return
|
||||
stage.cancel()
|
||||
cause = None
|
||||
try:
|
||||
with _validated_directories(self._root, self._session):
|
||||
_remove_directory(stage._directory, stage._identity)
|
||||
except (OSError, UnsafePathError, ArtifactStoreError):
|
||||
raise RenderStoreError("cleanup_failed") from None
|
||||
except (OSError, UnsafePathError, ArtifactStoreError) as error:
|
||||
cause = _cleanup_cause(error)
|
||||
if cause is not None:
|
||||
_raise_cleanup_failure(cause)
|
||||
del self._stages[stage.job_id]
|
||||
|
||||
def commit(
|
||||
@@ -399,18 +469,21 @@ class RenderOutputStore:
|
||||
with _validated_directories(self._root, self._session, stage._directory):
|
||||
# Encoder return is not publication: flush/close the complete output and
|
||||
# receipt, discard inputs, then rename only the verified pair atomically.
|
||||
with stage.output_path.open("r+b") as stream:
|
||||
with _native_io_path(stage.output_path).open("r+b") as stream:
|
||||
os.fsync(stream.fileno())
|
||||
_write_new_file(stage._directory / "receipt.json", payload)
|
||||
for name in tuple(stage._files - {"output.mp4"}):
|
||||
validate_regular_file(stage._directory / name).unlink()
|
||||
_native_io_path(validate_regular_file(stage._directory / name)).unlink()
|
||||
stage._files = {"output.mp4", "receipt.json"}
|
||||
self._stage(stage)
|
||||
destination = self._session / ("artifact-" + uuid.uuid4().hex)
|
||||
with _validated_directories(self._root, self._session):
|
||||
if destination.exists() or destination.is_symlink():
|
||||
if (
|
||||
_native_io_path(destination).exists()
|
||||
or _native_io_path(destination).is_symlink()
|
||||
):
|
||||
raise RenderStoreError("job_conflict")
|
||||
os.replace(stage._directory, destination)
|
||||
os.replace(_native_io_path(stage._directory), _native_io_path(destination))
|
||||
if _directory_identity(destination) != stage._identity:
|
||||
raise RenderStoreError("unsafe_store")
|
||||
self._verify_body(destination / "output.mp4", receipt)
|
||||
@@ -442,7 +515,7 @@ class RenderOutputStore:
|
||||
# directory identity authorizes destination cleanup; preserve foreign entries.
|
||||
if (
|
||||
destination is not None
|
||||
and destination.exists()
|
||||
and _native_io_path(destination).exists()
|
||||
and _directory_identity(destination) == stage._identity
|
||||
):
|
||||
with _validated_directories(self._root, self._session):
|
||||
@@ -507,8 +580,10 @@ class RenderOutputStore:
|
||||
if self._marker_descriptor is not None:
|
||||
os.close(self._marker_descriptor)
|
||||
self._marker_descriptor = None
|
||||
validate_regular_file(self._session / "owner.json", maximum_bytes=1024).unlink()
|
||||
_native_io_path(
|
||||
validate_regular_file(self._session / "owner.json", maximum_bytes=1024)
|
||||
).unlink()
|
||||
if _directory_identity(self._session) != self._session_identity:
|
||||
raise RenderStoreError("unsafe_store")
|
||||
self._session.rmdir()
|
||||
_native_io_path(self._session).rmdir()
|
||||
self._closed = True
|
||||
|
||||
@@ -29,7 +29,7 @@ from .authoring_render_service import RenderExecutionIdentity, RenderServiceErro
|
||||
# CRITICAL: reissue each changed Source/Public subject by executing its actual corpus;
|
||||
# Source admission alone cannot qualify the redacted renderer's implementation bytes.
|
||||
_ACCEPTED_EVIDENCE: Final[str | None] = (
|
||||
"sha256:008b3af6f6ee872302ad8bd0ce6191d2b715b55362729e4f42297d1aeec3c60c"
|
||||
"sha256:7b1059b02d8662802ffd948035fdb9257162add4177360a50b00d7d36861e280"
|
||||
)
|
||||
_PACKAGE = Path(__file__).resolve().parents[1]
|
||||
_EVIDENCE = _PACKAGE / "contracts" / "authoring_renderer_qualification_v2.json"
|
||||
|
||||
@@ -41,7 +41,9 @@ from ..core.native_composition import (
|
||||
NativeCompositionQualification,
|
||||
qualify_native_composition,
|
||||
)
|
||||
from ..core.native_guide import GUIDE_NODE_ID, observe_guide_capability
|
||||
from ..core.native_h3 import NativeH3Wiring
|
||||
from ..core.native_keyframe_structure import classify_native_keyframe_source
|
||||
from ..core.native_source_compatibility import NativeSourceObservation
|
||||
from ..core.native_t2va_structure import MAX_SOURCE_BYTES, classify_native_t2va_source
|
||||
from ..core.perception_producer import PerceptionProducerResult
|
||||
@@ -629,10 +631,20 @@ def _observe_native_source() -> NativeSourceObservation | None:
|
||||
).hexdigest()
|
||||
# CRITICAL: parse-only classification of the same bytes; host code is never imported here.
|
||||
# The origin stays in process for currentness and is never serialized or sent to a browser.
|
||||
mappings = getattr(_host_module("nodes"), "NODE_CLASS_MAPPINGS", None)
|
||||
guide = mappings.get(GUIDE_NODE_ID) if isinstance(mappings, dict) else None
|
||||
module_guide = getattr(module, GUIDE_NODE_ID, None)
|
||||
guide_registered = (
|
||||
isinstance(guide, type)
|
||||
and guide is module_guide
|
||||
and _host_module(getattr(guide, "__module__", "")) is module
|
||||
)
|
||||
return NativeSourceObservation(
|
||||
blob,
|
||||
classify_native_t2va_source(content),
|
||||
(module, classes, location, status.st_dev, status.st_ino),
|
||||
(module, classes, location, status.st_dev, status.st_ino, guide, module_guide),
|
||||
keyframes=classify_native_keyframe_source(content),
|
||||
guide=observe_guide_capability(content, registered=guide_registered),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -361,6 +361,7 @@ class _ReceiptEntry:
|
||||
source_path: Path = field(repr=False)
|
||||
source_fingerprint: str
|
||||
expires_at: float
|
||||
locator_parts: tuple[str, ...] = field(repr=False)
|
||||
|
||||
|
||||
class InputGeometryRegistry:
|
||||
@@ -453,13 +454,15 @@ class InputGeometryRegistry:
|
||||
source_path=source,
|
||||
source_fingerprint=source_fingerprint,
|
||||
expires_at=now + self._ttl_seconds,
|
||||
locator_parts=_locator_parts(request.locator),
|
||||
)
|
||||
return receipt
|
||||
finally:
|
||||
self._slots.release()
|
||||
|
||||
def claim(self, value: object) -> InputGeometryReceipt:
|
||||
def claim(self, value: object, *, locator: object | None = None) -> InputGeometryReceipt:
|
||||
receipt = InputGeometryReceipt.from_wire(value)
|
||||
locator_parts = None if locator is None else _locator_parts(locator)
|
||||
now = self._clock()
|
||||
with self._lock:
|
||||
self._prune(now)
|
||||
@@ -468,6 +471,10 @@ class InputGeometryRegistry:
|
||||
raise GeometryPreflightError("geometry_receipt_stale", 409)
|
||||
if entry.receipt != receipt:
|
||||
raise GeometryPreflightError("geometry_receipt_mismatch", 422)
|
||||
# CRITICAL: a sequence reuses the locator after Start. A receipt for another file must
|
||||
# not authorize that retained locator, even when both files have identical dimensions.
|
||||
if locator_parts is not None and locator_parts != entry.locator_parts:
|
||||
raise GeometryPreflightError("geometry_receipt_mismatch", 422)
|
||||
try:
|
||||
probe = _probe_file(
|
||||
entry.source_path,
|
||||
@@ -543,6 +550,11 @@ def claim_input_geometry_receipt(value: object) -> InputGeometryReceipt:
|
||||
return _registry().claim(value)
|
||||
|
||||
|
||||
def claim_input_geometry_source(value: object, *, locator: str) -> InputGeometryReceipt:
|
||||
"""Claim a one-shot receipt for the exact private sequence locator, without pool growth."""
|
||||
return _registry().claim(value, locator=locator)
|
||||
|
||||
|
||||
def _error_body(category: str) -> dict[str, str]:
|
||||
return {"schema": INPUT_GEOMETRY_ERROR_SCHEMA, "category": category}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ from collections.abc import Callable, Mapping
|
||||
from dataclasses import dataclass, field, replace
|
||||
from hashlib import sha256
|
||||
from pathlib import Path
|
||||
from typing import NoReturn
|
||||
from typing import NoReturn, cast
|
||||
|
||||
from ..core.canonical import binary64_token, canonical_bytes, canonical_fingerprint
|
||||
from ..core.durable_workspace_state import StateRecord
|
||||
@@ -77,6 +77,7 @@ from .comfyui_input_geometry import (
|
||||
GeometryPreflightError,
|
||||
InputGeometryReceipt,
|
||||
claim_input_geometry_receipt,
|
||||
claim_input_geometry_source,
|
||||
)
|
||||
from .comfyui_production_workspace import (
|
||||
PRODUCTION_ACTION_SCHEMA,
|
||||
@@ -118,6 +119,13 @@ from .segment_artifact_store import (
|
||||
PrivateSegmentArtifactStore,
|
||||
_read_regular_bytes,
|
||||
)
|
||||
from .sequence_media_bindings import SequenceMediaBindingError
|
||||
from .sequence_media_observation import (
|
||||
SEQUENCE_PREPARED_GRAPH_OBSERVATION_SCHEMA,
|
||||
SequenceMediaSourceIdentityV1,
|
||||
claim_sequence_media_sources,
|
||||
decode_sequence_media_identities,
|
||||
)
|
||||
|
||||
COORDINATOR_ACTION_SCHEMA = "h3.context.generation_coordinator.action.v1"
|
||||
COORDINATOR_RESPONSE_SCHEMA = "h3.context.generation_coordinator.response.v1"
|
||||
@@ -379,11 +387,26 @@ class PreparedGraphObservation:
|
||||
source_identity: InputGeometryReceipt | None
|
||||
timeout_ms: int
|
||||
native_anchor_node_id: str
|
||||
source_identities: tuple[SequenceMediaSourceIdentityV1, ...] = field(default=(), kw_only=True)
|
||||
media_binding_fingerprint: str | None = field(default=None, kw_only=True)
|
||||
schema: str = PREPARED_GRAPH_OBSERVATION_SCHEMA
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
if self.schema != PREPARED_GRAPH_OBSERVATION_SCHEMA:
|
||||
if self.schema not in {
|
||||
PREPARED_GRAPH_OBSERVATION_SCHEMA,
|
||||
SEQUENCE_PREPARED_GRAPH_OBSERVATION_SCHEMA,
|
||||
}:
|
||||
raise SequenceCoordinatorError("invalid_observation_schema", 400)
|
||||
if self.schema == SEQUENCE_PREPARED_GRAPH_OBSERVATION_SCHEMA:
|
||||
if self.source_identity is not None:
|
||||
raise SequenceCoordinatorError("invalid_source_identity", 400)
|
||||
decode_sequence_media_identities([row.to_wire() for row in self.source_identities])
|
||||
if self.media_binding_fingerprint is not None:
|
||||
_fingerprint(self.media_binding_fingerprint, "media_binding_fingerprint")
|
||||
if bool(self.source_identities) != (self.media_binding_fingerprint is not None):
|
||||
raise SequenceCoordinatorError("invalid_source_identity", 400)
|
||||
elif self.source_identities or self.media_binding_fingerprint is not None:
|
||||
raise SequenceCoordinatorError("invalid_source_identity", 400)
|
||||
if self.route not in _MANAGED_ROUTES:
|
||||
raise SequenceCoordinatorError("unmanaged_route", 422)
|
||||
for value, field_name in (
|
||||
@@ -406,6 +429,10 @@ class PreparedGraphObservation:
|
||||
|
||||
@classmethod
|
||||
def from_wire(cls, value: object) -> PreparedGraphObservation:
|
||||
is_sequence = (
|
||||
type(value) is dict
|
||||
and value.get("schema") == SEQUENCE_PREPARED_GRAPH_OBSERVATION_SCHEMA
|
||||
)
|
||||
wire = _closed(
|
||||
value,
|
||||
{
|
||||
@@ -420,7 +447,11 @@ class PreparedGraphObservation:
|
||||
"runtime_fingerprint",
|
||||
"fingerprint_domain",
|
||||
"expected_frames",
|
||||
"source_identity",
|
||||
*(
|
||||
{"source_identities", "media_binding_fingerprint"}
|
||||
if is_sequence
|
||||
else {"source_identity"}
|
||||
),
|
||||
"timeout_ms",
|
||||
"native_anchor_node_id",
|
||||
},
|
||||
@@ -443,7 +474,7 @@ class PreparedGraphObservation:
|
||||
try:
|
||||
source_identity = (
|
||||
None
|
||||
if wire["source_identity"] is None
|
||||
if is_sequence or wire["source_identity"] is None
|
||||
else InputGeometryReceipt.from_wire(wire["source_identity"])
|
||||
)
|
||||
except GeometryPreflightError as exc:
|
||||
@@ -469,10 +500,16 @@ class PreparedGraphObservation:
|
||||
native_anchor_node_id=_identifier(
|
||||
wire["native_anchor_node_id"], "native_anchor_node_id"
|
||||
),
|
||||
source_identities=decode_sequence_media_identities(wire["source_identities"])
|
||||
if is_sequence
|
||||
else (),
|
||||
media_binding_fingerprint=cast(str, wire["media_binding_fingerprint"])
|
||||
if is_sequence
|
||||
else None,
|
||||
)
|
||||
|
||||
def to_wire(self) -> dict[str, object]:
|
||||
return {
|
||||
wire = {
|
||||
"schema": self.schema,
|
||||
"route": self.route,
|
||||
"graph_fingerprint": self.graph_fingerprint,
|
||||
@@ -490,6 +527,13 @@ class PreparedGraphObservation:
|
||||
"timeout_ms": self.timeout_ms,
|
||||
"native_anchor_node_id": self.native_anchor_node_id,
|
||||
}
|
||||
if self.schema == SEQUENCE_PREPARED_GRAPH_OBSERVATION_SCHEMA:
|
||||
wire.pop("source_identity")
|
||||
wire.update(
|
||||
source_identities=[row.to_wire() for row in self.source_identities],
|
||||
media_binding_fingerprint=self.media_binding_fingerprint,
|
||||
)
|
||||
return wire
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
@@ -1122,6 +1166,7 @@ class SequenceCoordinatorRegistry:
|
||||
] = PrivateSegmentArtifactStore,
|
||||
artifact_inspector: ArtifactInspector = _default_artifact_inspector,
|
||||
geometry_receipt_claimant: GeometryReceiptClaimant = claim_input_geometry_receipt,
|
||||
sequence_media_claimant: Callable[..., InputGeometryReceipt] = claim_input_geometry_source,
|
||||
clock: Callable[[], float] = time.monotonic,
|
||||
clock_ms: Callable[[], int] = lambda: time.time_ns() // 1_000_000,
|
||||
token_factory: Callable[[], str] = lambda: secrets.token_urlsafe(40),
|
||||
@@ -1135,6 +1180,7 @@ class SequenceCoordinatorRegistry:
|
||||
or not callable(artifact_store_factory)
|
||||
or not callable(artifact_inspector)
|
||||
or not callable(geometry_receipt_claimant)
|
||||
or not callable(sequence_media_claimant)
|
||||
or not callable(clock)
|
||||
or not callable(clock_ms)
|
||||
or not callable(token_factory)
|
||||
@@ -1150,6 +1196,7 @@ class SequenceCoordinatorRegistry:
|
||||
self._artifact_store_factory = artifact_store_factory
|
||||
self._artifact_inspector = artifact_inspector
|
||||
self._geometry_receipt_claimant = geometry_receipt_claimant
|
||||
self._sequence_media_claimant = sequence_media_claimant
|
||||
self._clock = clock
|
||||
self._clock_ms = clock_ms
|
||||
self._token_factory = token_factory
|
||||
@@ -1530,6 +1577,25 @@ class SequenceCoordinatorRegistry:
|
||||
state = self._managed_start_state(parent_sequence_id, request_fingerprint)
|
||||
state.artifact_capacity_released = True
|
||||
|
||||
def _claim_managed_sequence_media(
|
||||
self,
|
||||
request: ManagedChildBindingRequestV1,
|
||||
) -> InputGeometryReceipt | None:
|
||||
if request.sequence_task_mode is None:
|
||||
return None
|
||||
try:
|
||||
claimed = claim_sequence_media_sources(
|
||||
request.sequence_media_bindings,
|
||||
request.observation.source_identities,
|
||||
request.observation.media_binding_fingerprint,
|
||||
self._sequence_media_claimant,
|
||||
)
|
||||
except SequenceMediaBindingError as exc:
|
||||
raise ManagedSequenceServiceError(exc.code, exc.status) from exc
|
||||
# Only global I2VA owns source geometry. Frame anchors in FL2VA/L2VA must not
|
||||
# silently change their official template's geometry to that of a declared image.
|
||||
return claimed[0] if request.sequence_task_mode.value == "i2va" and claimed else None
|
||||
|
||||
def bind_managed_sequence_child(
|
||||
self,
|
||||
request: ManagedChildBindingRequestV1,
|
||||
@@ -1557,11 +1623,17 @@ class SequenceCoordinatorRegistry:
|
||||
if len(self._runs) >= self._max_runs:
|
||||
raise ManagedSequenceServiceError("child_binding_coordinator_capacity", 503)
|
||||
|
||||
# CRITICAL: claim every retained source before either branch can create child
|
||||
# Production/ManagedRun authority. A changed/deleted image must never reach queue.
|
||||
sequence_geometry = self._claim_managed_sequence_media(request)
|
||||
|
||||
if (
|
||||
request.source_authority is not None
|
||||
or request.production_workspace_handle is not None
|
||||
):
|
||||
return self._bind_original_managed_child(request, resource, now)
|
||||
return self._bind_original_managed_child(
|
||||
request, resource, now, sequence_geometry=sequence_geometry
|
||||
)
|
||||
|
||||
correlation = ExecutionCorrelation(
|
||||
request.correlation.pending_correlation_id,
|
||||
@@ -1631,7 +1703,7 @@ class SequenceCoordinatorRegistry:
|
||||
(spec,),
|
||||
)
|
||||
state = create_generation_sequence_state(plan)
|
||||
geometry_receipt: InputGeometryReceipt | None = None
|
||||
geometry_receipt: InputGeometryReceipt | None = sequence_geometry
|
||||
if observation.source_identity is not None:
|
||||
geometry_receipt = self._geometry_receipt_claimant(
|
||||
observation.source_identity.to_wire()
|
||||
@@ -1768,6 +1840,8 @@ class SequenceCoordinatorRegistry:
|
||||
request: ManagedChildBindingRequestV1,
|
||||
resource: _ManagedStartResourceState,
|
||||
now: float,
|
||||
*,
|
||||
sequence_geometry: InputGeometryReceipt | None = None,
|
||||
) -> ManagedChildBindingClaimV1:
|
||||
source = request.source_authority
|
||||
handle = request.production_workspace_handle
|
||||
@@ -1841,7 +1915,7 @@ class SequenceCoordinatorRegistry:
|
||||
source.workspace, handle, sequence
|
||||
)
|
||||
geometry = (
|
||||
None
|
||||
sequence_geometry
|
||||
if observation.source_identity is None
|
||||
else self._geometry_receipt_claimant(observation.source_identity.to_wire())
|
||||
)
|
||||
@@ -2289,6 +2363,9 @@ class SequenceCoordinatorRegistry:
|
||||
) -> GenerationSequenceState:
|
||||
"""Plan the one managed job a single-segment workspace executes."""
|
||||
|
||||
if observation.schema == SEQUENCE_PREPARED_GRAPH_OBSERVATION_SCHEMA:
|
||||
raise SequenceCoordinatorError("sequence_media_authority_unavailable", 409)
|
||||
|
||||
if not single_segment_sequence(len(workspace.segments)):
|
||||
raise SequenceCoordinatorError("managed_workspace_shape", 422)
|
||||
manifests = derive_segment_manifests(workspace)
|
||||
@@ -2875,6 +2952,26 @@ class SequenceCoordinatorRegistry:
|
||||
)
|
||||
return error.with_artifact_context(retry_disposition=retry_disposition)
|
||||
|
||||
def _check_managed_sequence_canvas(
|
||||
self, ticket: _ArtifactVerificationTicket, shape: tuple[int, ...]
|
||||
) -> None:
|
||||
with self._lock:
|
||||
self._assert_artifact_ticket(ticket)
|
||||
resource = self._managed_resource_for_child(ticket.entry.run_handle)
|
||||
if resource is None or resource.original_authority is None:
|
||||
return
|
||||
if not resource.completed_children:
|
||||
return
|
||||
first_manifest = derive_segment_manifests(resource.original_authority.workspace)[0]
|
||||
first = resource.completed_children.get(first_manifest.segment_id)
|
||||
if first is None:
|
||||
raise SequenceCoordinatorError("artifact_receipt_mismatch", 422)
|
||||
# CRITICAL: the parent's first completed receipt owns height/width; frame counts
|
||||
# may differ. Independent axis bounds accept 864x480 beside 640x640 siblings.
|
||||
# Keep this comparison before storage/publication, including committed retries.
|
||||
if shape[1:3] != first.receipt.shape[1:3]:
|
||||
raise SequenceCoordinatorError("artifact_shape_mismatch", 422)
|
||||
|
||||
def _artifact(
|
||||
self, payload: dict[str, object], now: float, ticket: _ArtifactVerificationTicket
|
||||
) -> SequenceCoordinatorResponse:
|
||||
@@ -2992,6 +3089,7 @@ class SequenceCoordinatorRegistry:
|
||||
)
|
||||
if type(observed) is not ObservedVideoArtifact:
|
||||
raise SequenceCoordinatorError("artifact_media_invalid", 422)
|
||||
self._check_managed_sequence_canvas(ticket, observed.shape)
|
||||
if candidate.partial_receipt is None:
|
||||
# CRITICAL: managed children share the complete original workspace; selecting
|
||||
# the first manifest would silently mint every later output for segment one.
|
||||
@@ -3052,6 +3150,7 @@ class SequenceCoordinatorRegistry:
|
||||
complete = candidate.completed_receipt
|
||||
if complete is None: # pragma: no cover - guarded by the assignment above
|
||||
raise RuntimeError("artifact completion invariant")
|
||||
self._check_managed_sequence_canvas(ticket, complete.shape)
|
||||
self._check_artifact_ticket(ticket)
|
||||
preview_state = record_generation_success(
|
||||
working,
|
||||
|
||||
@@ -29,6 +29,7 @@ from ..core.durable_workspace_state import (
|
||||
from ..core.private_storage_layout import MIB, private_subtree_path
|
||||
from ..core.safe_paths import (
|
||||
UnsafePathError,
|
||||
_native_io_path,
|
||||
ensure_directory,
|
||||
validate_directory,
|
||||
validate_regular_file,
|
||||
@@ -177,25 +178,27 @@ def _owner_bytes(owner: str) -> bytes:
|
||||
|
||||
def _exists(path: Path) -> bool:
|
||||
try:
|
||||
path.lstat()
|
||||
_native_io_path(path).lstat()
|
||||
return True
|
||||
except FileNotFoundError:
|
||||
return False
|
||||
|
||||
|
||||
def _read(path: Path, maximum: int) -> tuple[bytes, os.stat_result]:
|
||||
before = validate_regular_file(path, maximum_bytes=maximum).lstat()
|
||||
# CRITICAL: validation returns logical paths; prefix each syscall, never stored identities.
|
||||
# A plain follow-up lstat still fails past MAX_PATH after safe component validation succeeds.
|
||||
before = _native_io_path(validate_regular_file(path, maximum_bytes=maximum)).lstat()
|
||||
if before.st_nlink != 1:
|
||||
raise DurableStateError("storage_unsafe")
|
||||
payload = _read_regular_bytes(path, maximum_bytes=maximum)
|
||||
if _identity(before) != _identity(path.lstat()):
|
||||
if _identity(before) != _identity(_native_io_path(path).lstat()):
|
||||
raise DurableStateError("storage_unsafe")
|
||||
return payload, before
|
||||
|
||||
|
||||
def _delete(path: Path, expected: os.stat_result) -> None:
|
||||
with _validated_directories(path.parent):
|
||||
actual = validate_regular_file(path).lstat()
|
||||
actual = _native_io_path(validate_regular_file(path)).lstat()
|
||||
if actual.st_nlink != 1 or _identity(actual) != _identity(expected):
|
||||
raise DurableStateError("storage_unsafe")
|
||||
if os.name == "nt":
|
||||
@@ -220,12 +223,15 @@ def _replace_manifest(
|
||||
) -> None:
|
||||
"""Publish a closed single-link manifest without following the destination entry."""
|
||||
with _validated_directories(source.parent, target.parent):
|
||||
before = validate_regular_file(source, maximum_bytes=maximum_bytes).lstat()
|
||||
before = _native_io_path(validate_regular_file(source, maximum_bytes=maximum_bytes)).lstat()
|
||||
if source.parent != target.parent or before.st_nlink != 1:
|
||||
raise DurableStateError("storage_unsafe")
|
||||
if (
|
||||
_exists(target)
|
||||
and validate_regular_file(target, maximum_bytes=maximum_bytes).lstat().st_nlink != 1
|
||||
and _native_io_path(validate_regular_file(target, maximum_bytes=maximum_bytes))
|
||||
.lstat()
|
||||
.st_nlink
|
||||
!= 1
|
||||
):
|
||||
raise DurableStateError("storage_unsafe")
|
||||
if os.name != "nt":
|
||||
@@ -277,7 +283,8 @@ def _replace_manifest(
|
||||
("name", wintypes.WCHAR * 1),
|
||||
)
|
||||
|
||||
name = str(target).encode("utf-16-le")
|
||||
# CRITICAL: the pinned source alone does not extend the rename destination buffer.
|
||||
name = _windows_native_path(target, force=True).encode("utf-16-le")
|
||||
size = ctypes.sizeof(RenameInfo) + len(name)
|
||||
buffer = ctypes.create_string_buffer(size)
|
||||
info = ctypes.cast(buffer, ctypes.POINTER(RenameInfo)).contents
|
||||
@@ -290,7 +297,7 @@ def _replace_manifest(
|
||||
# A closed-source pathname race could publish an unrelated substituted manifest.
|
||||
if not setter(_msvcrt_get_osfhandle(descriptor), 3, buffer, size):
|
||||
raise OSError(_windows_last_error(), "manifest_replace_failed")
|
||||
if _identity(os.fstat(descriptor)) != _identity(target.lstat()):
|
||||
if _identity(os.fstat(descriptor)) != _identity(_native_io_path(target).lstat()):
|
||||
raise DurableStateError("storage_unsafe")
|
||||
finally:
|
||||
if descriptor is None:
|
||||
@@ -333,7 +340,7 @@ class DurableStateStore:
|
||||
if self._lease is None or self._owner_identity != identity:
|
||||
raise DurableStateError("storage_unsafe")
|
||||
path = self.owner_directory / _OWNER_LOCK
|
||||
before = validate_regular_file(path, maximum_bytes=1024).lstat()
|
||||
before = _native_io_path(validate_regular_file(path, maximum_bytes=1024)).lstat()
|
||||
opened = os.fstat(self._lease)
|
||||
expected = _owner_bytes(self.owner_id)
|
||||
if (
|
||||
@@ -350,7 +357,7 @@ class DurableStateStore:
|
||||
if (
|
||||
payload != expected
|
||||
or _identity(os.fstat(self._lease)) != _identity(opened)
|
||||
or _identity(path.lstat()) != _identity(opened)
|
||||
or _identity(_native_io_path(path).lstat()) != _identity(opened)
|
||||
):
|
||||
raise DurableStateError("storage_unsafe")
|
||||
|
||||
@@ -400,7 +407,9 @@ class DurableStateStore:
|
||||
raise DurableStateError("quota_bytes")
|
||||
ensure_directory(self.owner_directory)
|
||||
with _validated_directories(self.owner_directory):
|
||||
identity = _directory_identity(self.owner_directory.lstat())
|
||||
identity = _directory_identity(
|
||||
_native_io_path(self.owner_directory).lstat()
|
||||
)
|
||||
if self._lease is None:
|
||||
if not _exists(self.owner_directory / _OWNER_LOCK):
|
||||
total, _ = self._inventory()
|
||||
@@ -437,7 +446,7 @@ class DurableStateStore:
|
||||
|
||||
def _owners(self) -> tuple[Path, ...]:
|
||||
owners = []
|
||||
with os.scandir(self.root) as entries:
|
||||
with os.scandir(_native_io_path(self.root)) as entries:
|
||||
for count, entry in enumerate(entries, 1):
|
||||
if count > 18:
|
||||
raise DurableStateError("quota_directory")
|
||||
@@ -453,7 +462,7 @@ class DurableStateStore:
|
||||
def _files(self, owner: Path) -> tuple[tuple[Path, os.stat_result], ...]:
|
||||
files = []
|
||||
snapshots = 0
|
||||
with os.scandir(owner) as entries:
|
||||
with os.scandir(_native_io_path(owner)) as entries:
|
||||
for count, entry in enumerate(entries, 1):
|
||||
if count > 6:
|
||||
raise DurableStateError("quota_directory")
|
||||
@@ -471,7 +480,9 @@ class DurableStateStore:
|
||||
if entry.name in {_MANIFEST, _PENDING}
|
||||
else MAX_SNAPSHOT_BYTES
|
||||
)
|
||||
metadata = validate_regular_file(path, maximum_bytes=maximum).lstat()
|
||||
metadata = _native_io_path(
|
||||
validate_regular_file(path, maximum_bytes=maximum)
|
||||
).lstat()
|
||||
if metadata.st_nlink != 1:
|
||||
raise DurableStateError("storage_unsafe")
|
||||
files.append((path, metadata))
|
||||
@@ -526,7 +537,7 @@ class DurableStateStore:
|
||||
|
||||
def _inventory(self) -> tuple[int, dict[str, set[str]]]:
|
||||
files = [
|
||||
(self.root / name, (self.root / name).lstat())
|
||||
(self.root / name, (_native_io_path(self.root / name)).lstat())
|
||||
for name in (_FAMILY_MARKER, _CATALOG_LOCK)
|
||||
]
|
||||
owners = self._owners()
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
"""Pinned 64-wide luma frames for declared-image and generated-frame matching.
|
||||
|
||||
This measurement adapter keeps the existing 96-wide seam metric unchanged. It retains
|
||||
pixels only in memory and reports closed failure codes rather than source paths.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from decimal import Decimal
|
||||
from pathlib import Path
|
||||
from typing import Final
|
||||
|
||||
from .executable_admission import ExecutableAdmissionError, pin_exact_executable
|
||||
from .media_subprocess import MediaProcessInvocation, ProcessStatus, SubprocessMediaRunner
|
||||
from .seam_observation_media import scaled_height, seam_observation_binary_capability
|
||||
|
||||
LUMA_WIDTH: Final = 64
|
||||
_MAX_DIMENSION: Final = 16_384
|
||||
_MAX_FRAMES: Final = 4096
|
||||
_MAX_DECODE_BYTES: Final = 64 * 1024 * 1024
|
||||
|
||||
|
||||
class KeyframeMatchMediaError(RuntimeError):
|
||||
"""A closed measurement failure code."""
|
||||
|
||||
def __init__(self, code: str) -> None:
|
||||
super().__init__(code)
|
||||
self.code = code
|
||||
|
||||
|
||||
def _require(condition: bool, code: str) -> None:
|
||||
if not condition:
|
||||
raise KeyframeMatchMediaError(code)
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class KeyframeMatchFrames:
|
||||
width: int
|
||||
height: int
|
||||
frames: tuple[bytes, ...] = field(repr=False)
|
||||
|
||||
|
||||
def mean_absolute_luma_difference(left: bytes, right: bytes) -> float:
|
||||
"""Mean absolute difference in raw 0..255 luma units, over every pixel."""
|
||||
|
||||
_require(type(left) is bytes and type(right) is bytes and 0 < len(left) == len(right), "extent")
|
||||
return sum(abs(a - b) for a, b in zip(left, right, strict=True)) / len(left)
|
||||
|
||||
|
||||
class KeyframeMatchDecoder:
|
||||
"""Decode bounded MP4 sequences and PNG references with the same pinned FFmpeg."""
|
||||
|
||||
def __init__(self, ffmpeg_path: Path) -> None:
|
||||
_require(isinstance(ffmpeg_path, Path) and ffmpeg_path.is_absolute(), "unsupported")
|
||||
self._digest = seam_observation_binary_capability().ffmpeg_sha256
|
||||
try:
|
||||
with pin_exact_executable(ffmpeg_path, self._digest):
|
||||
pass
|
||||
except (ExecutableAdmissionError, OSError):
|
||||
raise KeyframeMatchMediaError("unsupported") from None
|
||||
self._ffmpeg = ffmpeg_path
|
||||
self._runner = SubprocessMediaRunner()
|
||||
|
||||
@staticmethod
|
||||
def _dimensions(width: int, height: int) -> None:
|
||||
_require(
|
||||
all(type(value) is int and 0 < value <= _MAX_DIMENSION for value in (width, height)),
|
||||
"geometry",
|
||||
)
|
||||
|
||||
def video_frames(
|
||||
self, source: Path, *, source_width: int, source_height: int, frames: int
|
||||
) -> KeyframeMatchFrames:
|
||||
self._dimensions(source_width, source_height)
|
||||
_require(type(frames) is int and 0 < frames <= _MAX_FRAMES, "extent")
|
||||
height = scaled_height(source_width, source_height, LUMA_WIDTH)
|
||||
return self._decode(source, height, frames, crop=None, image=False)
|
||||
|
||||
def image_frame(
|
||||
self,
|
||||
source: Path,
|
||||
*,
|
||||
source_width: int,
|
||||
source_height: int,
|
||||
crop: tuple[int, int, int, int] | None = None,
|
||||
) -> KeyframeMatchFrames:
|
||||
self._dimensions(source_width, source_height)
|
||||
if crop is not None:
|
||||
_require(
|
||||
type(crop) is tuple
|
||||
and len(crop) == 4
|
||||
and all(type(value) is int for value in crop),
|
||||
"geometry",
|
||||
)
|
||||
x, y, width, height = crop
|
||||
_require(
|
||||
x >= 0
|
||||
and y >= 0
|
||||
and width >= 32
|
||||
and height >= 32
|
||||
and x + width <= source_width
|
||||
and y + height <= source_height,
|
||||
"geometry",
|
||||
)
|
||||
else:
|
||||
width, height = source_width, source_height
|
||||
return self._decode(
|
||||
source, scaled_height(width, height, LUMA_WIDTH), 1, crop=crop, image=True
|
||||
)
|
||||
|
||||
def _decode(
|
||||
self,
|
||||
source: Path,
|
||||
height: int,
|
||||
frames: int,
|
||||
*,
|
||||
crop: tuple[int, int, int, int] | None,
|
||||
image: bool,
|
||||
) -> KeyframeMatchFrames:
|
||||
expected_bytes = LUMA_WIDTH * height * frames
|
||||
_require(expected_bytes <= _MAX_DECODE_BYTES, "extent")
|
||||
try:
|
||||
_require(
|
||||
isinstance(source, Path) and source.is_absolute() and source.is_file(), "source"
|
||||
)
|
||||
except OSError:
|
||||
raise KeyframeMatchMediaError("source") from None
|
||||
demuxer = "png_pipe" if image else "mov"
|
||||
codecs = ("png", "rawvideo") if image else ("h264", "aac", "rawvideo")
|
||||
filters = f"scale={LUMA_WIDTH}:{height}:flags=area,format=gray"
|
||||
if crop is not None:
|
||||
x, y, width, crop_height = crop
|
||||
filters = f"crop={width}:{crop_height}:{x}:{y}," + filters
|
||||
argv = (
|
||||
str(self._ffmpeg),
|
||||
"-hide_banner",
|
||||
"-loglevel",
|
||||
"error",
|
||||
"-nostdin",
|
||||
"-protocol_whitelist",
|
||||
"file",
|
||||
"-format_whitelist",
|
||||
demuxer,
|
||||
"-i",
|
||||
str(source),
|
||||
"-map",
|
||||
"0:v:0",
|
||||
"-an",
|
||||
"-sn",
|
||||
"-dn",
|
||||
"-vf",
|
||||
filters,
|
||||
*(("-frames:v", "1") if image else ()),
|
||||
"-c:v",
|
||||
"rawvideo",
|
||||
"-f",
|
||||
"rawvideo",
|
||||
"pipe:1",
|
||||
)
|
||||
invocation = MediaProcessInvocation(
|
||||
tool="ffmpeg",
|
||||
executable=str(self._ffmpeg),
|
||||
argv=argv,
|
||||
protocol_whitelist=("file",),
|
||||
format_whitelist=(demuxer,),
|
||||
codec_whitelist=codecs,
|
||||
timeout_seconds=Decimal(300),
|
||||
max_stdout_bytes=expected_bytes,
|
||||
max_stderr_bytes=256 * 1024,
|
||||
)
|
||||
try:
|
||||
with pin_exact_executable(self._ffmpeg, self._digest):
|
||||
capture = self._runner.run(invocation)
|
||||
except (ExecutableAdmissionError, OSError):
|
||||
raise KeyframeMatchMediaError("unsupported") from None
|
||||
if capture.status is ProcessStatus.OUTPUT_LIMIT:
|
||||
raise KeyframeMatchMediaError("frame_count")
|
||||
_require(
|
||||
capture.status is ProcessStatus.SUCCEEDED and capture.cleanup_succeeded, "decode_failed"
|
||||
)
|
||||
# IMPORTANT: do not truncate to the expected prefix. A missing or extra decoded frame
|
||||
# shifts first/last comparisons and can falsely certify a different generated interval.
|
||||
_require(len(capture.stdout) == expected_bytes, "frame_count")
|
||||
frame_bytes = LUMA_WIDTH * height
|
||||
return KeyframeMatchFrames(
|
||||
LUMA_WIDTH,
|
||||
height,
|
||||
tuple(
|
||||
capture.stdout[index * frame_bytes : (index + 1) * frame_bytes]
|
||||
for index in range(frames)
|
||||
),
|
||||
)
|
||||
@@ -17,6 +17,7 @@ from ..core.canonical import canonical_bytes
|
||||
from ..core.private_storage_layout import MANAGED_ARTIFACT_SUBTREE, MIB, private_subtree_path
|
||||
from ..core.safe_paths import (
|
||||
UnsafePathError,
|
||||
_native_io_path,
|
||||
ensure_directory,
|
||||
validate_directory,
|
||||
validate_regular_file,
|
||||
@@ -189,7 +190,8 @@ def _acquire_lock(path: Path, expected: bytes, budget: _Budget | None = None) ->
|
||||
if budget is not None:
|
||||
budget.check()
|
||||
admitted = validate_regular_file(path, maximum_bytes=1024)
|
||||
before = admitted.lstat()
|
||||
# CRITICAL: stat the logical lock in native spelling; validation does not rewrite its Path.
|
||||
before = _native_io_path(admitted).lstat()
|
||||
if before.st_nlink != 1:
|
||||
raise ArtifactStoreError("unsafe_scope_lock")
|
||||
descriptor = (
|
||||
@@ -234,7 +236,7 @@ def _acquire_lock(path: Path, expected: bytes, budget: _Budget | None = None) ->
|
||||
if (
|
||||
payload != expected
|
||||
or _identity(os.fstat(descriptor)) != _identity(opened)
|
||||
or _identity(admitted.lstat()) != _identity(opened)
|
||||
or _identity(_native_io_path(admitted).lstat()) != _identity(opened)
|
||||
):
|
||||
raise ArtifactStoreError("unsafe_scope_lock")
|
||||
return descriptor
|
||||
@@ -259,7 +261,7 @@ def _read_metadata(path: Path, budget: _Budget | None = None) -> tuple[bytes, os
|
||||
|
||||
|
||||
def _create_or_admit(path: Path, payload: bytes) -> None:
|
||||
if path.exists():
|
||||
if _native_io_path(path).exists():
|
||||
return
|
||||
try:
|
||||
_write_new_file(path, payload)
|
||||
|
||||
@@ -12,11 +12,13 @@ from contextlib import contextmanager
|
||||
from pathlib import Path
|
||||
|
||||
from ..core.canonical import canonical_fingerprint
|
||||
from ..core.contracts import TaskMode
|
||||
from ..core.contracts import MediaKind, TaskMode
|
||||
from ..core.generation_profile import FamilyDisposition, materialization_bases
|
||||
from ..core.guide_conformance import evaluate_guide_conformance
|
||||
from ..core.managed_sequence import ManagedModeQualificationV1, ManagedModeQualificationV2
|
||||
from ..core.native_composition import NativeCompositionDisposition
|
||||
from ..core.native_guide import NativeGuideCapability
|
||||
from ..core.native_keyframe_structure import is_production_admission as is_keyframe_admission
|
||||
from ..core.native_mode_matrix import build_default_native_mode_matrix
|
||||
from ..core.native_source_compatibility import NativeSourceObservation
|
||||
from ..core.production_import import ProductionAutomaticPlanAuthorityV2
|
||||
@@ -27,13 +29,24 @@ from .managed_asset_resolution import (
|
||||
build_managed_asset_resolution,
|
||||
build_managed_native_composition,
|
||||
)
|
||||
from .production_context_materializer import claim_canonical_production_materialization
|
||||
from .production_context_materializer import (
|
||||
ProductionCanonicalLoweringV2,
|
||||
claim_canonical_production_materialization,
|
||||
)
|
||||
|
||||
QUALIFICATION_TTL_SECONDS = 60
|
||||
#: Issued qualifications whose loaded-source observation is retained for later currentness checks.
|
||||
_MAX_ISSUED_SOURCES = 8
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
_NOT_ISSUED = object()
|
||||
#: The composition reasons that say the loaded native source was read and no audited lineage admits
|
||||
#: it. They are the only holds that get the distinct public reason below.
|
||||
_UNRECOGNIZED_SOURCE_COMPOSITION_REASONS = frozenset(
|
||||
{
|
||||
"native_t2va_structure_changed",
|
||||
"native_keyframe_structure_changed",
|
||||
}
|
||||
)
|
||||
_COMPILER_SOURCES = (
|
||||
"core/audit_override.py",
|
||||
"core/canonical.py",
|
||||
@@ -50,6 +63,10 @@ _COMPILER_SOURCES = (
|
||||
"core/native_source_compatibility.py",
|
||||
"core/native_t2va_structure.py",
|
||||
"core/native_t2va_baseline.py",
|
||||
"core/native_keyframe_structure.py",
|
||||
"core/native_keyframe_baseline.py",
|
||||
"core/native_baseline_v0_44.py",
|
||||
"core/native_guide.py",
|
||||
"core/native_h3.py",
|
||||
"core/native_mode_matrix.py",
|
||||
"core/normalization.py",
|
||||
@@ -230,17 +247,51 @@ class ManagedQualificationProducer:
|
||||
composition.reason,
|
||||
composition.detail,
|
||||
)
|
||||
raise ProductionWorkbenchError("qualification_composition_unqualified", 409)
|
||||
# CRITICAL: only a source that was read and matched no audited lineage gets
|
||||
# native_source_structure_unrecognized, whose advice is to update ComfyUI
|
||||
# first and this extension second. A missing native workflow, an
|
||||
# unreadable source or a held audio set keeps the generic reason, because
|
||||
# that advice would send those users to the wrong fix.
|
||||
raise ProductionWorkbenchError(
|
||||
(
|
||||
"native_source_structure_unrecognized"
|
||||
if composition.reason in _UNRECOGNIZED_SOURCE_COMPOSITION_REASONS
|
||||
else "qualification_composition_unqualified"
|
||||
),
|
||||
409,
|
||||
)
|
||||
if composition.observed_source() != source:
|
||||
raise ProductionWorkbenchError("qualification_changed", 409)
|
||||
admission = composition.detail
|
||||
# IMPORTANT: semantic asset IDs do not name owned ComfyUI loader nodes.
|
||||
# Match the shipped prepared-child resolver; otherwise readiness authorizes
|
||||
# a parent whose first child is certain to fail before it can bind a graph.
|
||||
roles = {
|
||||
TaskMode.T2VA: (),
|
||||
TaskMode.I2VA: ("first_frame",),
|
||||
TaskMode.L2VA: ("last_frame",),
|
||||
TaskMode.FL2VA: ("first_frame", "last_frame"),
|
||||
}.get(snapshot.report.request.task_mode)
|
||||
lowering = snapshot.canonical_lowering
|
||||
# CRITICAL: readiness qualifies only the canonical frame recipe and loaded
|
||||
# native/guide support. Exact locator/receipt claims remain a Start gate.
|
||||
if (
|
||||
snapshot.report.request.task_mode is not TaskMode.T2VA
|
||||
or snapshot.wiring.bindings
|
||||
or snapshot.canonical_lowering is None
|
||||
roles is None
|
||||
or lowering is None
|
||||
or tuple(row.native_input for row in snapshot.wiring.bindings) != roles
|
||||
or any(
|
||||
row.kind is not MediaKind.IMAGE or row.native_slot != row.native_input
|
||||
for row in snapshot.wiring.bindings
|
||||
)
|
||||
or (
|
||||
roles
|
||||
and (
|
||||
type(lowering) is not ProductionCanonicalLoweringV2
|
||||
or lowering.task_mode is not snapshot.report.request.task_mode
|
||||
or tuple(role.value for role in lowering.binding_roles) != roles
|
||||
or type(source) is not NativeSourceObservation
|
||||
or not is_keyframe_admission(source.keyframes)
|
||||
or type(source.guide) is not NativeGuideCapability
|
||||
or not source.guide.admitted
|
||||
)
|
||||
)
|
||||
):
|
||||
raise ProductionWorkbenchError(
|
||||
"qualification_host_bindings_unavailable", 409
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -36,7 +36,12 @@ from pathlib import Path, PureWindowsPath
|
||||
from typing import Protocol
|
||||
|
||||
from ..core.av_reconstruction import qualified_ffmpeg_capability
|
||||
from ..core.safe_paths import UnsafePathError, ensure_directory, read_regular_file_bytes
|
||||
from ..core.safe_paths import (
|
||||
UnsafePathError,
|
||||
_native_io_path,
|
||||
ensure_directory,
|
||||
read_regular_file_bytes,
|
||||
)
|
||||
from .composition_root import MEDIA_RUNTIME_RESOLVER, component
|
||||
from .media_runtime_discovery_worker import (
|
||||
FFMPEG_NAME,
|
||||
@@ -615,7 +620,8 @@ def _link_free_existing_prefix(path: Path) -> bool:
|
||||
for part in path.parts[1:]:
|
||||
current = current / part
|
||||
try:
|
||||
metadata = current.lstat()
|
||||
# CRITICAL: a plain stat misclassifies an existing long prefix as a missing tail.
|
||||
metadata = _native_io_path(current).lstat()
|
||||
except FileNotFoundError:
|
||||
return True
|
||||
except OSError:
|
||||
@@ -623,7 +629,7 @@ def _link_free_existing_prefix(path: Path) -> bool:
|
||||
attributes = getattr(metadata, "st_file_attributes", 0)
|
||||
reparse = getattr(stat, "FILE_ATTRIBUTE_REPARSE_POINT", 0)
|
||||
if (
|
||||
current.is_symlink()
|
||||
_native_io_path(current).is_symlink()
|
||||
or stat.S_ISLNK(metadata.st_mode)
|
||||
or attributes & reparse
|
||||
or not stat.S_ISDIR(metadata.st_mode)
|
||||
|
||||
@@ -8,6 +8,7 @@ from collections.abc import Callable
|
||||
from dataclasses import dataclass, field, replace
|
||||
from decimal import Decimal
|
||||
from hashlib import sha256
|
||||
from typing import ClassVar, cast
|
||||
|
||||
from ..core.audit_override import MAX_OVERRIDE_REVISION, stage_audit_override
|
||||
from ..core.canonical import canonical_fingerprint, fingerprint_context_report
|
||||
@@ -31,7 +32,14 @@ from ..core.constraints import (
|
||||
TimingConstraint,
|
||||
)
|
||||
from ..core.context_reporting import ContextPlan, ContextReport
|
||||
from ..core.contracts import CURRENT_PROFILE_VERSION, ProfileIdentity, PromptProfile, TaskMode
|
||||
from ..core.contracts import (
|
||||
CURRENT_PROFILE_VERSION,
|
||||
AssetRole,
|
||||
MediaKind,
|
||||
ProfileIdentity,
|
||||
PromptProfile,
|
||||
TaskMode,
|
||||
)
|
||||
from ..core.dialogue_speakers import render_dialogue_line
|
||||
from ..core.evidence import EvidenceSet
|
||||
from ..core.intent_graph import build_intent_graph
|
||||
@@ -72,6 +80,12 @@ from .production_planning_source import (
|
||||
)
|
||||
|
||||
PRODUCTION_CANONICAL_LOWERING_SCHEMA = "h3.context.production_canonical_lowering.v1"
|
||||
PRODUCTION_FRAME_CANONICAL_LOWERING_SCHEMA = "h3.context.production_canonical_lowering.v2"
|
||||
_FRAME_LOWERING_ROLES: dict[str, tuple[AssetRole, ...]] = {
|
||||
TaskMode.I2VA: (AssetRole.FIRST_FRAME,),
|
||||
TaskMode.L2VA: (AssetRole.LAST_FRAME,),
|
||||
TaskMode.FL2VA: (AssetRole.FIRST_FRAME, AssetRole.LAST_FRAME),
|
||||
}
|
||||
PRODUCTION_CANONICAL_LOWERING_REASON = "Materialize approved Production segment prompt"
|
||||
MAX_PRODUCTION_CANONICAL_LOWERING_PROMPT_LENGTH = 4_096
|
||||
_FINGERPRINT = re.compile(r"sha256:[0-9a-f]{64}\Z")
|
||||
@@ -86,9 +100,10 @@ class ProductionCanonicalLoweringV1:
|
||||
override_revision: int
|
||||
reason: str = PRODUCTION_CANONICAL_LOWERING_REASON
|
||||
schema: str = PRODUCTION_CANONICAL_LOWERING_SCHEMA
|
||||
expected_schema: ClassVar[str] = PRODUCTION_CANONICAL_LOWERING_SCHEMA
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
if self.schema != PRODUCTION_CANONICAL_LOWERING_SCHEMA:
|
||||
if self.schema != self.expected_schema:
|
||||
raise ProductionImportError("canonical_lowering_schema")
|
||||
if self.reason != PRODUCTION_CANONICAL_LOWERING_REASON:
|
||||
raise ProductionImportError("canonical_lowering_reason")
|
||||
@@ -116,6 +131,33 @@ class ProductionCanonicalLoweringV1:
|
||||
}
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class ProductionCanonicalLoweringV2(ProductionCanonicalLoweringV1):
|
||||
"""Exact public Request/Registry/Plan recipe, with no host source content."""
|
||||
|
||||
task_mode: TaskMode = field(kw_only=True)
|
||||
binding_roles: tuple[AssetRole, ...] = field(kw_only=True)
|
||||
schema: str = PRODUCTION_FRAME_CANONICAL_LOWERING_SCHEMA
|
||||
expected_schema: ClassVar[str] = PRODUCTION_FRAME_CANONICAL_LOWERING_SCHEMA
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
ProductionCanonicalLoweringV1.__post_init__(self)
|
||||
if (
|
||||
type(self.task_mode) is not TaskMode
|
||||
or self.task_mode not in _FRAME_LOWERING_ROLES
|
||||
or type(self.binding_roles) is not tuple
|
||||
or self.binding_roles != _FRAME_LOWERING_ROLES[self.task_mode]
|
||||
):
|
||||
raise ProductionImportError("canonical_lowering_frame_roles")
|
||||
|
||||
def to_wire(self) -> dict[str, object]:
|
||||
return {
|
||||
**ProductionCanonicalLoweringV1.to_wire(self),
|
||||
"task_mode": self.task_mode.value,
|
||||
"binding_roles": [role.value for role in self.binding_roles],
|
||||
}
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class CanonicalProductionMaterializationSnapshot:
|
||||
"""Internal immutable join for one live canonical scratch Context."""
|
||||
@@ -166,14 +208,12 @@ def _derive_canonical_lowering(
|
||||
plan: ContextPlan,
|
||||
compiled_report: ContextReport,
|
||||
segment: ProposalSegmentV1,
|
||||
) -> ProductionCanonicalLoweringV1 | None:
|
||||
) -> ProductionCanonicalLoweringV1 | ProductionCanonicalLoweringV2 | None:
|
||||
"""Certify only a graph recipe the public Request node can reproduce exactly."""
|
||||
|
||||
default_profile = ProfileIdentity(PromptProfile.BASE, CURRENT_PROFILE_VERSION)
|
||||
if (
|
||||
request.mode is not TaskMode.T2VA
|
||||
or request.assets != ()
|
||||
or request.reference_registry != ReferenceRegistry.empty()
|
||||
request.mode not in {TaskMode.T2VA, *_FRAME_LOWERING_ROLES}
|
||||
or request.hard_constraints != HardConstraintSet.empty()
|
||||
or request.evidence != EvidenceSet.empty()
|
||||
or plan.request.profile != default_profile
|
||||
@@ -183,12 +223,27 @@ def _derive_canonical_lowering(
|
||||
return None
|
||||
duration_milliseconds = segment.duration.requested_seconds * 1_000
|
||||
try:
|
||||
roles = _FRAME_LOWERING_ROLES.get(request.mode, ())
|
||||
# CRITICAL: reconstruct the public Registry's metadata-free role slots, never
|
||||
# copy arbitrary source assets into the certificate. Whole-plan equality below
|
||||
# then refuses unrepresentable IDs, metadata, constraints and evidence.
|
||||
registry = build_reference_registry(
|
||||
tuple(
|
||||
ReferenceAsset(f"{role.value}_1", MediaKind.IMAGE, role, ordinal)
|
||||
for ordinal, role in enumerate(roles, start=1)
|
||||
)
|
||||
)
|
||||
if (
|
||||
request.reference_registry != registry
|
||||
or request.assets != registry.to_asset_descriptors()
|
||||
):
|
||||
return None
|
||||
rebuilt_request = build_canonical_context_request(
|
||||
TaskMode.T2VA,
|
||||
request.mode,
|
||||
segment.local_prompt,
|
||||
duration_milliseconds / 1_000,
|
||||
)
|
||||
rebuilt_plan = build_canonical_context_plan(rebuilt_request)[0]
|
||||
rebuilt_plan = build_canonical_context_plan(rebuilt_request, registry)[0]
|
||||
# CRITICAL: prompt equality alone misses absent forbidden constraints and evidence. The
|
||||
# whole typed plan and Compiler report identity must match before exposing this recipe.
|
||||
if rebuilt_plan != plan:
|
||||
@@ -197,6 +252,14 @@ def _derive_canonical_lowering(
|
||||
compiled_fingerprint = fingerprint_context_report(compiled_report)
|
||||
if fingerprint_context_report(rebuilt_report) != compiled_fingerprint:
|
||||
return None
|
||||
if roles:
|
||||
return ProductionCanonicalLoweringV2(
|
||||
base_report_fingerprint=compiled_fingerprint,
|
||||
base_report_revision=compiled_report.revision,
|
||||
override_revision=compiled_report.revision + 1,
|
||||
task_mode=cast(TaskMode, request.mode),
|
||||
binding_roles=roles,
|
||||
)
|
||||
return ProductionCanonicalLoweringV1(
|
||||
base_report_fingerprint=compiled_fingerprint,
|
||||
base_report_revision=compiled_report.revision,
|
||||
@@ -227,7 +290,9 @@ def _project_dialogue_bindings(source: ContextPlan, local: ContextPlan, prompt:
|
||||
for row in local.hard_constraints.exact_texts
|
||||
if row.kind in (ExactTextKind.DIALOGUE, ExactTextKind.LYRICS)
|
||||
)
|
||||
if not lines:
|
||||
# CRITICAL: retained Subject labels need the ordered source subjects even without dialogue;
|
||||
# returning the empty local graph makes the real Validator reject their definitions.
|
||||
if not lines and not source.intent_graph.subjects:
|
||||
return local
|
||||
source_lines = {row.constraint_id: row for row in source.hard_constraints.exact_texts}
|
||||
subject_ids: set[str] = set()
|
||||
|
||||
@@ -23,6 +23,7 @@ from typing import Any
|
||||
from ..core.canonical import canonical_bytes, canonical_fingerprint
|
||||
from ..core.safe_paths import (
|
||||
UnsafePathError,
|
||||
_native_io_path,
|
||||
ensure_directory,
|
||||
validate_directory,
|
||||
validate_regular_file,
|
||||
@@ -225,12 +226,16 @@ def _directory_identity(metadata: os.stat_result) -> tuple[int, int]:
|
||||
def _is_link_or_reparse(path: Path, metadata: os.stat_result) -> bool:
|
||||
attributes = getattr(metadata, "st_file_attributes", 0)
|
||||
reparse_flag = getattr(stat, "FILE_ATTRIBUTE_REPARSE_POINT", 0)
|
||||
return bool(path.is_symlink() or stat.S_ISLNK(metadata.st_mode) or attributes & reparse_flag)
|
||||
return bool(
|
||||
_native_io_path(path).is_symlink()
|
||||
or stat.S_ISLNK(metadata.st_mode)
|
||||
or attributes & reparse_flag
|
||||
)
|
||||
|
||||
|
||||
def _lstat_optional(path: Path) -> os.stat_result | None:
|
||||
try:
|
||||
return path.lstat()
|
||||
return _native_io_path(path).lstat()
|
||||
except FileNotFoundError:
|
||||
return None
|
||||
except OSError as exc:
|
||||
@@ -257,7 +262,7 @@ def _validated_directories(*directories: Path) -> Iterator[None]:
|
||||
identities: dict[Path, tuple[int, int]] = {}
|
||||
for directory in unique:
|
||||
admitted = validate_directory(directory)
|
||||
metadata = admitted.lstat()
|
||||
metadata = _native_io_path(admitted).lstat()
|
||||
identity = _directory_identity(metadata)
|
||||
identities[directory] = identity
|
||||
if os.name == "nt":
|
||||
@@ -274,7 +279,7 @@ def _validated_directories(*directories: Path) -> Iterator[None]:
|
||||
raise ArtifactStoreError("unsafe_store_entry")
|
||||
yield
|
||||
for directory, identity in identities.items():
|
||||
current = validate_directory(directory).lstat()
|
||||
current = _native_io_path(validate_directory(directory)).lstat()
|
||||
if _directory_identity(current) != identity:
|
||||
raise ArtifactStoreError("unsafe_store_entry")
|
||||
pinned_descriptor = pinned.get(directory)
|
||||
@@ -301,7 +306,7 @@ def _read_regular_bytes(path: Path, *, maximum_bytes: int) -> bytes:
|
||||
def _read_regular_bytes_pinned(path: Path, *, maximum_bytes: int) -> bytes:
|
||||
try:
|
||||
admitted = validate_regular_file(path, maximum_bytes=maximum_bytes)
|
||||
before = admitted.lstat()
|
||||
before = _native_io_path(admitted).lstat()
|
||||
except UnsafePathError as exc:
|
||||
raise ArtifactStoreError("unsafe_store_entry") from exc
|
||||
if before.st_nlink != 1:
|
||||
@@ -309,7 +314,9 @@ def _read_regular_bytes_pinned(path: Path, *, maximum_bytes: int) -> bytes:
|
||||
flags = os.O_RDONLY | getattr(os, "O_BINARY", 0) | getattr(os, "O_NOFOLLOW", 0)
|
||||
try:
|
||||
descriptor = (
|
||||
_windows_open_existing_file(admitted) if os.name == "nt" else os.open(admitted, flags)
|
||||
_windows_open_existing_file(admitted)
|
||||
if os.name == "nt"
|
||||
else os.open(_native_io_path(admitted), flags)
|
||||
)
|
||||
except OSError as exc:
|
||||
raise ArtifactStoreError("store_entry_unavailable") from exc
|
||||
@@ -331,7 +338,7 @@ def _read_regular_bytes_pinned(path: Path, *, maximum_bytes: int) -> bytes:
|
||||
remaining -= len(chunk)
|
||||
payload = b"".join(chunks)
|
||||
after_handle = os.fstat(descriptor)
|
||||
after_path = admitted.lstat()
|
||||
after_path = _native_io_path(admitted).lstat()
|
||||
if (
|
||||
len(payload) > maximum_bytes
|
||||
or _is_link_or_reparse(admitted, after_path)
|
||||
@@ -355,7 +362,7 @@ def _write_new_file(path: Path, payload: bytes) -> None:
|
||||
def _write_new_file_pinned(path: Path, payload: bytes) -> None:
|
||||
try:
|
||||
parent = validate_directory(path.parent)
|
||||
parent_before = parent.lstat()
|
||||
parent_before = _native_io_path(parent).lstat()
|
||||
except (UnsafePathError, OSError) as exc:
|
||||
raise ArtifactStoreError("unsafe_store_entry") from exc
|
||||
if path.parent != parent or path.name in {"", ".", ".."}:
|
||||
@@ -365,7 +372,7 @@ def _write_new_file_pinned(path: Path, payload: bytes) -> None:
|
||||
_windows_open_new_file(path)
|
||||
if os.name == "nt"
|
||||
else os.open(
|
||||
path,
|
||||
_native_io_path(path),
|
||||
os.O_WRONLY | os.O_CREAT | os.O_EXCL | getattr(os, "O_BINARY", 0),
|
||||
0o600,
|
||||
)
|
||||
@@ -377,9 +384,9 @@ def _write_new_file_pinned(path: Path, payload: bytes) -> None:
|
||||
created_identity: tuple[int, int, int, int] | None = None
|
||||
failure: ArtifactStoreError | None = None
|
||||
try:
|
||||
parent_opened = validate_directory(parent).lstat()
|
||||
parent_opened = _native_io_path(validate_directory(parent)).lstat()
|
||||
opened_handle = os.fstat(descriptor)
|
||||
opened_path = validate_regular_file(path, maximum_bytes=1).lstat()
|
||||
opened_path = _native_io_path(validate_regular_file(path, maximum_bytes=1)).lstat()
|
||||
created_identity = _identity(opened_handle)
|
||||
if (
|
||||
_directory_identity(parent_before) != _directory_identity(parent_opened)
|
||||
@@ -395,8 +402,10 @@ def _write_new_file_pinned(path: Path, payload: bytes) -> None:
|
||||
raise ArtifactStoreError("store_write_failed")
|
||||
view = view[written:]
|
||||
os.fsync(descriptor)
|
||||
parent_after = validate_directory(parent).lstat()
|
||||
created = validate_regular_file(path, maximum_bytes=max(len(payload), 1)).lstat()
|
||||
parent_after = _native_io_path(validate_directory(parent)).lstat()
|
||||
created = _native_io_path(
|
||||
validate_regular_file(path, maximum_bytes=max(len(payload), 1))
|
||||
).lstat()
|
||||
after_handle = os.fstat(descriptor)
|
||||
if (
|
||||
_directory_identity(parent_before) != _directory_identity(parent_after)
|
||||
@@ -465,7 +474,7 @@ def _copy_regular_file_into_new_pinned(
|
||||
|
||||
try:
|
||||
admitted = validate_regular_file(source, maximum_bytes=maximum_bytes)
|
||||
before = admitted.lstat()
|
||||
before = _native_io_path(admitted).lstat()
|
||||
except UnsafePathError as exc:
|
||||
raise ArtifactStoreError("unsafe_store_entry") from exc
|
||||
if before.st_nlink != 1:
|
||||
@@ -473,7 +482,9 @@ def _copy_regular_file_into_new_pinned(
|
||||
flags = os.O_RDONLY | getattr(os, "O_BINARY", 0) | getattr(os, "O_NOFOLLOW", 0)
|
||||
try:
|
||||
reader = (
|
||||
_windows_open_existing_file(admitted) if os.name == "nt" else os.open(admitted, flags)
|
||||
_windows_open_existing_file(admitted)
|
||||
if os.name == "nt"
|
||||
else os.open(_native_io_path(admitted), flags)
|
||||
)
|
||||
except OSError as exc:
|
||||
raise ArtifactStoreError("store_entry_unavailable") from exc
|
||||
@@ -487,7 +498,7 @@ def _copy_regular_file_into_new_pinned(
|
||||
raise ArtifactStoreError("unsafe_store_entry")
|
||||
try:
|
||||
parent = validate_directory(destination.parent)
|
||||
parent_before = parent.lstat()
|
||||
parent_before = _native_io_path(parent).lstat()
|
||||
except (UnsafePathError, OSError) as exc:
|
||||
raise ArtifactStoreError("unsafe_store_entry") from exc
|
||||
if destination.parent != parent or destination.name in {"", ".", ".."}:
|
||||
@@ -497,7 +508,7 @@ def _copy_regular_file_into_new_pinned(
|
||||
_windows_open_new_file(destination)
|
||||
if os.name == "nt"
|
||||
else os.open(
|
||||
destination,
|
||||
_native_io_path(destination),
|
||||
os.O_WRONLY | os.O_CREAT | os.O_EXCL | getattr(os, "O_BINARY", 0),
|
||||
0o600,
|
||||
)
|
||||
@@ -511,9 +522,11 @@ def _copy_regular_file_into_new_pinned(
|
||||
digest = hashlib.sha256()
|
||||
total = 0
|
||||
try:
|
||||
parent_opened = validate_directory(parent).lstat()
|
||||
parent_opened = _native_io_path(validate_directory(parent)).lstat()
|
||||
writer_handle = os.fstat(writer)
|
||||
writer_path = validate_regular_file(destination, maximum_bytes=1).lstat()
|
||||
writer_path = _native_io_path(
|
||||
validate_regular_file(destination, maximum_bytes=1)
|
||||
).lstat()
|
||||
created_identity = _identity(writer_handle)
|
||||
if (
|
||||
_directory_identity(parent_before) != _directory_identity(parent_opened)
|
||||
@@ -542,7 +555,7 @@ def _copy_regular_file_into_new_pinned(
|
||||
remaining -= len(chunk)
|
||||
os.fsync(writer)
|
||||
reader_after = os.fstat(reader)
|
||||
source_after = admitted.lstat()
|
||||
source_after = _native_io_path(admitted).lstat()
|
||||
if (
|
||||
_is_link_or_reparse(admitted, source_after)
|
||||
or source_after.st_nlink != 1
|
||||
@@ -550,8 +563,10 @@ def _copy_regular_file_into_new_pinned(
|
||||
or _identity(source_after) != _identity(opened)
|
||||
):
|
||||
raise ArtifactStoreError("unsafe_store_entry")
|
||||
parent_after = validate_directory(parent).lstat()
|
||||
created = validate_regular_file(destination, maximum_bytes=max(total, 1)).lstat()
|
||||
parent_after = _native_io_path(validate_directory(parent)).lstat()
|
||||
created = _native_io_path(
|
||||
validate_regular_file(destination, maximum_bytes=max(total, 1))
|
||||
).lstat()
|
||||
writer_after = os.fstat(writer)
|
||||
if (
|
||||
_directory_identity(parent_before) != _directory_identity(parent_after)
|
||||
@@ -616,14 +631,10 @@ def _msvcrt_get_osfhandle(descriptor: int) -> int:
|
||||
|
||||
|
||||
def _windows_native_path(path: Path, *, force: bool = False) -> str:
|
||||
value = str(path)
|
||||
if (not force and len(value) < 248) or value.startswith("\\\\?\\"):
|
||||
return value
|
||||
if not path.is_absolute() or ".." in path.parts:
|
||||
raise ArtifactStoreError("unsafe_store_entry")
|
||||
# CRITICAL: Python's long-path support does not extend to direct CreateFileW calls.
|
||||
# Prefix only an already admitted absolute path; never resolve across reparse components.
|
||||
return "\\\\?\\UNC\\" + value[2:] if value.startswith("\\\\") else "\\\\?\\" + value
|
||||
try:
|
||||
return str(_native_io_path(path, force=force))
|
||||
except UnsafePathError:
|
||||
raise ArtifactStoreError("unsafe_store_entry") from None
|
||||
|
||||
|
||||
def _windows_pin_directory(path: Path) -> int:
|
||||
@@ -773,7 +784,9 @@ def _windows_move_new_file(source: Path, destination: Path) -> int:
|
||||
("file_name", wintypes.WCHAR * 1),
|
||||
)
|
||||
|
||||
encoded_name = str(destination).encode("utf-16-le")
|
||||
# CRITICAL: FileRenameInfo does not inherit CreateFileW's extended source spelling.
|
||||
# Prefix its destination too; retain byte length and handle-based no-clobber rename.
|
||||
encoded_name = _windows_native_path(destination, force=True).encode("utf-16-le")
|
||||
buffer_size = ctypes.sizeof(FileRenameInfo) + len(encoded_name)
|
||||
buffer = ctypes.create_string_buffer(buffer_size)
|
||||
information = ctypes.cast(buffer, ctypes.POINTER(FileRenameInfo)).contents
|
||||
@@ -877,13 +890,13 @@ def _safe_unlink_pinned(
|
||||
admitted = validate_regular_file(path)
|
||||
except UnsafePathError as exc:
|
||||
raise ArtifactStoreError("unsafe_store_entry") from exc
|
||||
if _identity(admitted.lstat()) != _identity(metadata):
|
||||
if _identity(_native_io_path(admitted).lstat()) != _identity(metadata):
|
||||
raise ArtifactStoreError("unsafe_store_entry")
|
||||
if os.name == "nt":
|
||||
_windows_delete_exact(admitted, expected=metadata)
|
||||
return True
|
||||
try:
|
||||
path.unlink()
|
||||
_native_io_path(path).unlink()
|
||||
except OSError as exc:
|
||||
raise ArtifactStoreError("store_cleanup_failed") from exc
|
||||
return True
|
||||
@@ -1101,7 +1114,9 @@ class PrivateSegmentArtifactStore:
|
||||
try:
|
||||
if type(owner_lock) is not int or owner_lock < 0:
|
||||
raise ArtifactStoreError("unsafe_store_owner")
|
||||
owner = validate_regular_file(root / ".owner.lock", maximum_bytes=1_024).lstat()
|
||||
owner = _native_io_path(
|
||||
validate_regular_file(root / ".owner.lock", maximum_bytes=1_024)
|
||||
).lstat()
|
||||
opened = os.fstat(owner_lock)
|
||||
# CRITICAL: only the production lease's exact open single-link file extends
|
||||
# the closed root layout; merely finding an owner filename grants nothing.
|
||||
@@ -1164,7 +1179,10 @@ class PrivateSegmentArtifactStore:
|
||||
if self._owner_lock is not None:
|
||||
allowed_root_names.add(".owner.lock")
|
||||
try:
|
||||
if any(entry.name not in allowed_root_names for entry in self._root.iterdir()):
|
||||
if any(
|
||||
entry.name not in allowed_root_names
|
||||
for entry in _native_io_path(self._root).iterdir()
|
||||
):
|
||||
raise ArtifactStoreError("foreign_store_root")
|
||||
for name in _CHILD_NAMES:
|
||||
ensure_directory(self._root / name)
|
||||
@@ -1242,7 +1260,7 @@ class PrivateSegmentArtifactStore:
|
||||
try:
|
||||
validate_regular_file(self._state, maximum_bytes=1_024)
|
||||
# CRITICAL: replace only this validated store-owned state file; never accept a path.
|
||||
os.replace(temporary, self._state)
|
||||
os.replace(_native_io_path(temporary), _native_io_path(self._state))
|
||||
except (OSError, UnsafePathError) as exc:
|
||||
_safe_unlink(temporary, maximum_links=2)
|
||||
raise ArtifactStoreError("store_state_write_failed") from exc
|
||||
@@ -1262,8 +1280,10 @@ class PrivateSegmentArtifactStore:
|
||||
try:
|
||||
admitted_parent = validate_directory(parent)
|
||||
admitted_final_parent = validate_directory(final.parent)
|
||||
parent_identity = _directory_identity(admitted_parent.lstat())
|
||||
final_parent_identity = _directory_identity(admitted_final_parent.lstat())
|
||||
parent_identity = _directory_identity(_native_io_path(admitted_parent).lstat())
|
||||
final_parent_identity = _directory_identity(
|
||||
_native_io_path(admitted_final_parent).lstat()
|
||||
)
|
||||
except UnsafePathError as exc:
|
||||
raise ArtifactStoreError("unsafe_store_entry") from exc
|
||||
if admitted_parent != parent or admitted_final_parent != final.parent:
|
||||
@@ -1278,10 +1298,11 @@ class PrivateSegmentArtifactStore:
|
||||
published_descriptor: int | None = None
|
||||
try:
|
||||
_write_new_file(temporary, payload)
|
||||
temporary_identity = _identity(temporary.lstat())
|
||||
temporary_identity = _identity(_native_io_path(temporary).lstat())
|
||||
if (
|
||||
_directory_identity(validate_directory(parent).lstat()) != parent_identity
|
||||
or _directory_identity(validate_directory(final.parent).lstat())
|
||||
_directory_identity(_native_io_path(validate_directory(parent)).lstat())
|
||||
!= parent_identity
|
||||
or _directory_identity(_native_io_path(validate_directory(final.parent)).lstat())
|
||||
!= final_parent_identity
|
||||
):
|
||||
raise ArtifactStoreError("unsafe_store_entry")
|
||||
@@ -1297,8 +1318,8 @@ class PrivateSegmentArtifactStore:
|
||||
else:
|
||||
# Hard-link publication is atomic and fails instead of clobbering
|
||||
# an existing target.
|
||||
os.link(temporary, final, follow_symlinks=False)
|
||||
published_identity = _identity(final.lstat())
|
||||
os.link(_native_io_path(temporary), _native_io_path(final), follow_symlinks=False)
|
||||
published_identity = _identity(_native_io_path(final).lstat())
|
||||
except FileExistsError as exc:
|
||||
_safe_unlink(temporary, maximum_links=2)
|
||||
raise ArtifactStoreError("duplicate_artifact") from exc
|
||||
@@ -1316,10 +1337,11 @@ class PrivateSegmentArtifactStore:
|
||||
maximum_bytes=max(len(payload), 1),
|
||||
)
|
||||
if (
|
||||
_directory_identity(validate_directory(parent).lstat()) != parent_identity
|
||||
or _directory_identity(validate_directory(final.parent).lstat())
|
||||
_directory_identity(_native_io_path(validate_directory(parent)).lstat())
|
||||
!= parent_identity
|
||||
or _directory_identity(_native_io_path(validate_directory(final.parent)).lstat())
|
||||
!= final_parent_identity
|
||||
or _identity(admitted_final.lstat()) != published_identity
|
||||
or _identity(_native_io_path(admitted_final).lstat()) != published_identity
|
||||
or (
|
||||
published_descriptor is not None
|
||||
and _identity(os.fstat(published_descriptor)) != published_identity
|
||||
@@ -1335,7 +1357,7 @@ class PrivateSegmentArtifactStore:
|
||||
current = _lstat_optional(final)
|
||||
if current is not None and _identity(current) == published_identity:
|
||||
try:
|
||||
final.unlink()
|
||||
_native_io_path(final).unlink()
|
||||
except OSError:
|
||||
pass
|
||||
_safe_unlink(temporary, maximum_links=2)
|
||||
@@ -1916,14 +1938,14 @@ class PrivateSegmentArtifactStore:
|
||||
raise ArtifactStoreError("recovery_scan_limit")
|
||||
try:
|
||||
admitted = validate_directory(directory)
|
||||
before = admitted.lstat()
|
||||
before = _native_io_path(admitted).lstat()
|
||||
entries: list[Path] = []
|
||||
with os.scandir(admitted) as iterator:
|
||||
with os.scandir(_native_io_path(admitted)) as iterator:
|
||||
for entry in iterator:
|
||||
entries.append(admitted / entry.name)
|
||||
if len(entries) > maximum:
|
||||
raise ArtifactStoreError("recovery_scan_limit")
|
||||
after = validate_directory(admitted).lstat()
|
||||
after = _native_io_path(validate_directory(admitted)).lstat()
|
||||
except (UnsafePathError, OSError) as exc:
|
||||
raise ArtifactStoreError("unsafe_store_entry") from exc
|
||||
if _directory_identity(before) != _directory_identity(after):
|
||||
|
||||
@@ -0,0 +1,338 @@
|
||||
"""Closed, volatile execution bindings. Never embed these values in durable state.
|
||||
|
||||
Only the loopback Start and prepared-child execution wires carry locators or crops. The parent
|
||||
owner stores immutable entries, not serialized responses; its slot and entry-byte reservations
|
||||
are independent of the coordinator's unchanged control-response ledger.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import math
|
||||
import re
|
||||
import threading
|
||||
import time
|
||||
from collections.abc import Callable
|
||||
from dataclasses import dataclass, field
|
||||
from typing import cast
|
||||
|
||||
from ..core.canonical import canonical_fingerprint
|
||||
from ..core.contracts import AssetRole, MediaKind
|
||||
from ..core.managed_sequence import MAX_SEQUENCE_MEDIA_BINDING_BYTES, MAX_SEQUENCE_MEDIA_BINDINGS
|
||||
from ..core.registry import ReferenceRegistry
|
||||
from .comfyui_input_geometry import GeometryPreflightError, InputGeometryReceipt, _locator_parts
|
||||
|
||||
SEQUENCE_MEDIA_BINDING_SET_SCHEMA = "h3.context.sequence_media_binding_set.v1"
|
||||
SEQUENCE_MEDIA_CROP_NODE_TYPE = "ImageCropV2"
|
||||
MAX_CROP_DIMENSION = 16_384
|
||||
MAX_SEQUENCE_MEDIA_PARENTS = 16
|
||||
MAX_RETAINED_SEQUENCE_MEDIA_BYTES = (
|
||||
MAX_SEQUENCE_MEDIA_PARENTS * MAX_SEQUENCE_MEDIA_BINDINGS * MAX_SEQUENCE_MEDIA_BINDING_BYTES
|
||||
)
|
||||
_IDENTIFIER = re.compile(r"[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}\Z")
|
||||
|
||||
|
||||
class SequenceMediaBindingError(ValueError):
|
||||
"""Closed content-free refusal; no observed value may become diagnostic text."""
|
||||
|
||||
def __init__(self, code: str, status: int = 422) -> None:
|
||||
self.code, self.status = code, status
|
||||
super().__init__(code)
|
||||
|
||||
|
||||
def _identifier(value: object) -> str:
|
||||
if type(value) is not str or _IDENTIFIER.fullmatch(value) is None:
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid")
|
||||
return value
|
||||
|
||||
|
||||
def _closed(value: object, keys: set[str]) -> dict[str, object]:
|
||||
if type(value) is not dict or set(value) != keys:
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid")
|
||||
return value
|
||||
|
||||
|
||||
def _compact_bytes(value: object) -> bytes:
|
||||
try:
|
||||
return json.dumps(value, ensure_ascii=False, separators=(",", ":"), allow_nan=False).encode(
|
||||
"utf-8"
|
||||
)
|
||||
except (TypeError, ValueError, RecursionError) as exc:
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid") from exc
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True, repr=False)
|
||||
class SequenceMediaCropV1:
|
||||
node_id: str
|
||||
x: int
|
||||
y: int
|
||||
width: int
|
||||
height: int
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
_identifier(self.node_id)
|
||||
if (
|
||||
any(type(v) is not int for v in (self.x, self.y, self.width, self.height))
|
||||
or not 0 <= self.x <= MAX_CROP_DIMENSION
|
||||
or not 0 <= self.y <= MAX_CROP_DIMENSION
|
||||
or not 32 <= self.width <= MAX_CROP_DIMENSION
|
||||
or not 32 <= self.height <= MAX_CROP_DIMENSION
|
||||
or self.x + self.width > MAX_CROP_DIMENSION
|
||||
or self.y + self.height > MAX_CROP_DIMENSION
|
||||
):
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid")
|
||||
|
||||
@classmethod
|
||||
def from_wire(cls, value: object) -> SequenceMediaCropV1:
|
||||
wire = _closed(value, {"node_id", "class_type", "region"})
|
||||
if wire["class_type"] != SEQUENCE_MEDIA_CROP_NODE_TYPE:
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid")
|
||||
region = _closed(wire["region"], {"x", "y", "width", "height"})
|
||||
return cls(node_id=wire["node_id"], **region) # type: ignore[arg-type]
|
||||
|
||||
def to_wire(self) -> dict[str, object]:
|
||||
return {
|
||||
"node_id": self.node_id,
|
||||
"class_type": SEQUENCE_MEDIA_CROP_NODE_TYPE,
|
||||
"region": {"x": self.x, "y": self.y, "width": self.width, "height": self.height},
|
||||
}
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True, repr=False)
|
||||
class SequenceRegistryEndpointV1:
|
||||
node_id: str
|
||||
input_name: str
|
||||
source_node_id: str
|
||||
source_slot: int = 0
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
for value in (self.node_id, self.input_name, self.source_node_id):
|
||||
_identifier(value)
|
||||
if type(self.source_slot) is not int or self.source_slot != 0:
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid")
|
||||
|
||||
@classmethod
|
||||
def from_wire(cls, value: object) -> SequenceRegistryEndpointV1:
|
||||
return cls(**_closed(value, {"node_id", "input_name", "source_node_id", "source_slot"})) # type: ignore[arg-type]
|
||||
|
||||
def to_wire(self) -> dict[str, object]:
|
||||
return {
|
||||
"node_id": self.node_id,
|
||||
"input_name": self.input_name,
|
||||
"source_node_id": self.source_node_id,
|
||||
"source_slot": self.source_slot,
|
||||
}
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True, repr=False)
|
||||
class SequenceMediaBindingV1:
|
||||
asset_id: str
|
||||
role: AssetRole
|
||||
kind: MediaKind
|
||||
loader_class: str
|
||||
loader_node_id: str
|
||||
locator: str
|
||||
source_identity: InputGeometryReceipt
|
||||
registry_endpoint: SequenceRegistryEndpointV1
|
||||
transform: SequenceMediaCropV1 | None
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
_identifier(self.asset_id)
|
||||
_identifier(self.loader_node_id)
|
||||
if (
|
||||
type(self.role) is not AssetRole
|
||||
or self.kind is not MediaKind.IMAGE
|
||||
or self.loader_class != "LoadImage"
|
||||
or type(self.source_identity) is not InputGeometryReceipt
|
||||
or type(self.registry_endpoint) is not SequenceRegistryEndpointV1
|
||||
or (self.transform is not None and type(self.transform) is not SequenceMediaCropV1)
|
||||
):
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid")
|
||||
try:
|
||||
_locator_parts(self.locator)
|
||||
except GeometryPreflightError as exc:
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid") from exc
|
||||
endpoint = self.transform.node_id if self.transform else self.loader_node_id
|
||||
if self.registry_endpoint.source_node_id != endpoint or (
|
||||
self.transform is not None and self.transform.node_id == self.loader_node_id
|
||||
):
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid")
|
||||
if len(_compact_bytes(self.to_wire())) > MAX_SEQUENCE_MEDIA_BINDING_BYTES:
|
||||
raise SequenceMediaBindingError("sequence_media_binding_size")
|
||||
|
||||
@classmethod
|
||||
def from_wire(cls, value: object) -> SequenceMediaBindingV1:
|
||||
# IMPORTANT: enforce UTF-8 bytes before parsing private fields; UTF-16 character counts
|
||||
# admit oversized Unicode entries and invalidate the parent's fixed retention budget.
|
||||
try:
|
||||
if len(_compact_bytes(value)) > MAX_SEQUENCE_MEDIA_BINDING_BYTES:
|
||||
raise SequenceMediaBindingError("sequence_media_binding_size")
|
||||
wire = _closed(
|
||||
value,
|
||||
{
|
||||
"asset_id",
|
||||
"role",
|
||||
"kind",
|
||||
"loader_class",
|
||||
"loader_node_id",
|
||||
"locator",
|
||||
"source_identity",
|
||||
"registry_endpoint",
|
||||
"transform",
|
||||
},
|
||||
)
|
||||
return cls(
|
||||
asset_id=cast(str, wire["asset_id"]),
|
||||
role=AssetRole(wire["role"]),
|
||||
kind=MediaKind(wire["kind"]),
|
||||
loader_class=cast(str, wire["loader_class"]),
|
||||
loader_node_id=cast(str, wire["loader_node_id"]),
|
||||
locator=cast(str, wire["locator"]),
|
||||
source_identity=InputGeometryReceipt.from_wire(wire["source_identity"]),
|
||||
registry_endpoint=SequenceRegistryEndpointV1.from_wire(wire["registry_endpoint"]),
|
||||
transform=None
|
||||
if wire["transform"] is None
|
||||
else SequenceMediaCropV1.from_wire(wire["transform"]),
|
||||
)
|
||||
except SequenceMediaBindingError:
|
||||
raise
|
||||
except (TypeError, ValueError) as exc:
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid") from exc
|
||||
|
||||
def to_wire(self) -> dict[str, object]:
|
||||
return {
|
||||
"asset_id": self.asset_id,
|
||||
"role": self.role.value,
|
||||
"kind": self.kind.value,
|
||||
"loader_class": self.loader_class,
|
||||
"loader_node_id": self.loader_node_id,
|
||||
"locator": self.locator,
|
||||
"source_identity": self.source_identity.to_wire(),
|
||||
"registry_endpoint": self.registry_endpoint.to_wire(),
|
||||
"transform": None if self.transform is None else self.transform.to_wire(),
|
||||
}
|
||||
|
||||
@property
|
||||
def identity_wire(self) -> dict[str, object]:
|
||||
# CRITICAL: renewed receipts have new handles. The retained identity covers the file,
|
||||
# exact loader/Registry endpoint and crop, not the short-lived handle's allocation.
|
||||
wire = self.to_wire()
|
||||
locator = wire.pop("locator")
|
||||
# File locators are codepoint-exact, unlike canonical human text. Hash the raw JSON
|
||||
# string first so NFC normalization cannot merge distinct filesystem spellings.
|
||||
return {
|
||||
**wire,
|
||||
"locator_fingerprint": "sha256:" + hashlib.sha256(_compact_bytes(locator)).hexdigest(),
|
||||
"source_identity": {"source_fingerprint": self.source_identity.source_fingerprint},
|
||||
}
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True, repr=False)
|
||||
class SequenceMediaBindingSetV1:
|
||||
entries: tuple[SequenceMediaBindingV1, ...] = field(repr=False)
|
||||
schema: str = SEQUENCE_MEDIA_BINDING_SET_SCHEMA
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
if (
|
||||
self.schema != SEQUENCE_MEDIA_BINDING_SET_SCHEMA
|
||||
or type(self.entries) is not tuple
|
||||
or not 1 <= len(self.entries) <= MAX_SEQUENCE_MEDIA_BINDINGS
|
||||
or any(type(row) is not SequenceMediaBindingV1 for row in self.entries)
|
||||
or len({row.asset_id for row in self.entries}) != len(self.entries)
|
||||
):
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid")
|
||||
|
||||
@classmethod
|
||||
def from_wire(cls, value: object) -> SequenceMediaBindingSetV1:
|
||||
wire = _closed(value, {"schema", "entries"})
|
||||
rows = wire["entries"]
|
||||
if type(rows) is not list or not 1 <= len(rows) <= MAX_SEQUENCE_MEDIA_BINDINGS:
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid")
|
||||
return cls(
|
||||
tuple(SequenceMediaBindingV1.from_wire(row) for row in rows),
|
||||
schema=cast(str, wire["schema"]),
|
||||
)
|
||||
|
||||
def to_wire(self) -> dict[str, object]:
|
||||
return {"schema": self.schema, "entries": [row.to_wire() for row in self.entries]}
|
||||
|
||||
@property
|
||||
def fingerprint(self) -> str:
|
||||
return canonical_fingerprint(
|
||||
{
|
||||
"schema": self.schema,
|
||||
"entries": [
|
||||
row.identity_wire for row in sorted(self.entries, key=lambda row: row.asset_id)
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
def validate_registry(self, registry: ReferenceRegistry, asset_ids: tuple[str, ...]) -> None:
|
||||
required = {row.asset_id: row for row in registry.assets if row.asset_id in asset_ids}
|
||||
if set(required) != set(asset_ids) or set(required) != {
|
||||
row.asset_id for row in self.entries
|
||||
}:
|
||||
raise SequenceMediaBindingError("sequence_media_binding_missing")
|
||||
for row in self.entries:
|
||||
asset = required[row.asset_id]
|
||||
if asset.role is not row.role or asset.kind is not row.kind:
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid")
|
||||
|
||||
|
||||
class RetainedSequenceMediaBindings:
|
||||
"""One service-owned, separately bounded volatile pool; no projection/ledger writer."""
|
||||
|
||||
def __init__(self, *, clock: Callable[[], float] = time.monotonic) -> None:
|
||||
self._clock = clock
|
||||
self._entries: dict[str, tuple[SequenceMediaBindingSetV1, float]] = {}
|
||||
self._lock = threading.RLock()
|
||||
|
||||
def _prune(self) -> None:
|
||||
now = self._clock()
|
||||
for parent, (_bindings, expires) in tuple(self._entries.items()):
|
||||
if expires <= now:
|
||||
del self._entries[parent]
|
||||
|
||||
def retain(
|
||||
self, parent: str, bindings: SequenceMediaBindingSetV1, *, expires_at: float
|
||||
) -> None:
|
||||
_identifier(parent)
|
||||
if (
|
||||
type(bindings) is not SequenceMediaBindingSetV1
|
||||
or type(expires_at) not in {int, float}
|
||||
or not math.isfinite(expires_at)
|
||||
or not self._clock() < expires_at <= self._clock() + 86400
|
||||
):
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid")
|
||||
with self._lock:
|
||||
self._prune()
|
||||
if parent in self._entries:
|
||||
raise SequenceMediaBindingError("sequence_media_already_retained", 409)
|
||||
if len(self._entries) >= MAX_SEQUENCE_MEDIA_PARENTS:
|
||||
raise SequenceMediaBindingError("coordinator_run_capacity", 503)
|
||||
self._entries[parent] = bindings, expires_at
|
||||
|
||||
def get(self, parent: str) -> SequenceMediaBindingSetV1:
|
||||
with self._lock:
|
||||
self._prune()
|
||||
entry = self._entries.get(parent)
|
||||
if entry is None:
|
||||
raise SequenceMediaBindingError("sequence_media_unavailable", 409)
|
||||
return entry[0]
|
||||
|
||||
def release(self, parent: str) -> None:
|
||||
with self._lock:
|
||||
self._entries.pop(parent, None)
|
||||
|
||||
@property
|
||||
def parent_count(self) -> int:
|
||||
with self._lock:
|
||||
self._prune()
|
||||
return len(self._entries)
|
||||
|
||||
@property
|
||||
def reserved_bytes(self) -> int:
|
||||
# Reserve a maximum set per parent. Only entries are retained; fixed wire envelopes
|
||||
# and prepared responses are reconstructed on demand and never cached in this pool.
|
||||
return self.parent_count * MAX_SEQUENCE_MEDIA_BINDINGS * MAX_SEQUENCE_MEDIA_BINDING_BYTES
|
||||
@@ -0,0 +1,127 @@
|
||||
"""Content-free role-keyed observations for private retained sequence sources."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
from typing import cast
|
||||
|
||||
from ..core.contracts import AssetRole
|
||||
from .comfyui_input_geometry import GeometryPreflightError, InputGeometryReceipt
|
||||
from .sequence_media_bindings import (
|
||||
SequenceMediaBindingError,
|
||||
SequenceMediaBindingSetV1,
|
||||
_closed,
|
||||
_identifier,
|
||||
)
|
||||
|
||||
SEQUENCE_PREPARED_GRAPH_OBSERVATION_SCHEMA = "h3.context.prepared_graph_observation.v5"
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class SequenceMediaSourceIdentityV1:
|
||||
asset_id: str
|
||||
role: AssetRole
|
||||
source_identity: InputGeometryReceipt
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
_identifier(self.asset_id)
|
||||
if (
|
||||
self.role not in {AssetRole.FIRST_FRAME, AssetRole.LAST_FRAME}
|
||||
or type(self.source_identity) is not InputGeometryReceipt
|
||||
):
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid")
|
||||
|
||||
@classmethod
|
||||
def from_wire(cls, value: object) -> SequenceMediaSourceIdentityV1:
|
||||
# IMPORTANT: flat rows preserve the existing depth-5 control-message bound. Private
|
||||
# crop/locator state belongs only to Start and prepared execution responses.
|
||||
wire = _closed(value, {"asset_id", "role", "receipt_handle", "source_fingerprint"})
|
||||
try:
|
||||
return cls(
|
||||
cast(str, wire["asset_id"]),
|
||||
AssetRole(wire["role"]),
|
||||
InputGeometryReceipt.from_wire(
|
||||
{
|
||||
"schema": "h3.context.input_geometry.receipt.v2",
|
||||
"receipt_handle": wire["receipt_handle"],
|
||||
"source_fingerprint": wire["source_fingerprint"],
|
||||
}
|
||||
),
|
||||
)
|
||||
except (ValueError, TypeError) as exc:
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid") from exc
|
||||
|
||||
def to_wire(self) -> dict[str, object]:
|
||||
return {
|
||||
"asset_id": self.asset_id,
|
||||
"role": self.role.value,
|
||||
"receipt_handle": self.source_identity.receipt_handle,
|
||||
"source_fingerprint": self.source_identity.source_fingerprint,
|
||||
}
|
||||
|
||||
|
||||
def decode_sequence_media_identities(value: object) -> tuple[SequenceMediaSourceIdentityV1, ...]:
|
||||
if type(value) is not list or len(value) > 3:
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid")
|
||||
rows = tuple(SequenceMediaSourceIdentityV1.from_wire(row) for row in value)
|
||||
if len({row.asset_id for row in rows}) != len(rows):
|
||||
raise SequenceMediaBindingError("sequence_media_binding_invalid")
|
||||
return rows
|
||||
|
||||
|
||||
def validate_sequence_media_observation(
|
||||
expected: SequenceMediaBindingSetV1 | None,
|
||||
rows: tuple[SequenceMediaSourceIdentityV1, ...],
|
||||
binding_fingerprint: str | None,
|
||||
) -> None:
|
||||
if (
|
||||
type(rows) is not tuple
|
||||
or any(type(row) is not SequenceMediaSourceIdentityV1 for row in rows)
|
||||
or len(rows) > 3
|
||||
or len({row.asset_id for row in rows}) != len(rows)
|
||||
):
|
||||
raise SequenceMediaBindingError("sequence_media_changed", 409)
|
||||
entries = () if expected is None else expected.entries
|
||||
if binding_fingerprint != (None if expected is None else expected.fingerprint) or len(
|
||||
entries
|
||||
) != len(rows):
|
||||
raise SequenceMediaBindingError("sequence_media_changed", 409)
|
||||
by_id = {row.asset_id: row for row in rows}
|
||||
# CRITICAL: validate the complete set before consuming any one-shot receipt. A wrong file
|
||||
# or role must not leave a partially claimed child or borrow another asset's identity.
|
||||
if any(
|
||||
row.asset_id not in by_id
|
||||
or by_id[row.asset_id].role is not row.role
|
||||
or by_id[row.asset_id].source_identity.source_fingerprint
|
||||
!= row.source_identity.source_fingerprint
|
||||
for row in entries
|
||||
):
|
||||
raise SequenceMediaBindingError("sequence_media_changed", 409)
|
||||
|
||||
|
||||
def claim_sequence_media_sources(
|
||||
expected: SequenceMediaBindingSetV1 | None,
|
||||
rows: tuple[SequenceMediaSourceIdentityV1, ...],
|
||||
binding_fingerprint: str | None,
|
||||
claimant: Callable[..., InputGeometryReceipt],
|
||||
) -> tuple[InputGeometryReceipt, ...]:
|
||||
validate_sequence_media_observation(expected, rows, binding_fingerprint)
|
||||
by_id = {row.asset_id: row.source_identity for row in rows}
|
||||
claimed = []
|
||||
try:
|
||||
for row in () if expected is None else expected.entries:
|
||||
receipt = by_id[row.asset_id]
|
||||
result = claimant(receipt.to_wire(), locator=row.locator)
|
||||
if type(result) is not InputGeometryReceipt or result != receipt:
|
||||
raise SequenceMediaBindingError("sequence_media_changed", 409)
|
||||
claimed.append(result)
|
||||
except GeometryPreflightError as exc:
|
||||
cause = exc.__cause__
|
||||
missing = exc.code in {"input_unavailable", "geometry_receipt_stale"} or (
|
||||
isinstance(cause, GeometryPreflightError) and cause.code == "input_unavailable"
|
||||
)
|
||||
raise SequenceMediaBindingError(
|
||||
"sequence_media_unavailable" if missing else "sequence_media_changed", 409
|
||||
) from exc
|
||||
return tuple(claimed)
|
||||
File diff suppressed because one or more lines are too long
@@ -5,30 +5,30 @@
|
||||
},
|
||||
"bundle": {
|
||||
"path": "comfyui_h3_context/web/h3-context-sidebar.js",
|
||||
"sha256": "sha256:a67420d0c60f13801603f4898610d789270e296c3d713f63e2ec02244bea8fe7",
|
||||
"size": 1970766
|
||||
"sha256": "sha256:3ceff7b6ed79f4300945eae369f4f4d70026bb2682e550566e714f0de81e91c3",
|
||||
"size": 3933669
|
||||
},
|
||||
"embedded_identity": {
|
||||
"builder_id": "scripts/frontend_build_report.py",
|
||||
"resolved_dependencies_sha256": "sha256:545f3ad6c0687ba3bd93501e7f4225807fba71a6c80d0d135942a200ac22ddfb",
|
||||
"resolved_dependencies_sha256": "sha256:9e0a1e1bdf3d99b7b633ea4ced569a3a6311751163e267ff10d217d7bbdddb24",
|
||||
"schema": "h3-context-build-identity/1",
|
||||
"source_commit": "b9e8134c284b01a78b12a1e1983d7aba538cd81e",
|
||||
"source_inputs_sha256": "sha256:f43896d9be3bc9cb9ecff1d3bd57de0e1ac7d8bab96216ccb97dbd660cef277c",
|
||||
"source_tree": "ebc021cada7d88ba545a168040ca08a20fd10aa6"
|
||||
"source_commit": "144d97eb138f3d3dc4c31313540616c455ee5690",
|
||||
"source_inputs_sha256": "sha256:6efc5b1374102b76156c81997b3a75a4de3e0137e3580666195ea9b4a75b24d1",
|
||||
"source_tree": "16623b1544bbe4186d85a067573d33e569389883"
|
||||
},
|
||||
"external_parameters": {
|
||||
"source_commit": "b9e8134c284b01a78b12a1e1983d7aba538cd81e",
|
||||
"source_inputs_sha256": "sha256:f43896d9be3bc9cb9ecff1d3bd57de0e1ac7d8bab96216ccb97dbd660cef277c",
|
||||
"source_tree": "ebc021cada7d88ba545a168040ca08a20fd10aa6"
|
||||
"source_commit": "144d97eb138f3d3dc4c31313540616c455ee5690",
|
||||
"source_inputs_sha256": "sha256:6efc5b1374102b76156c81997b3a75a4de3e0137e3580666195ea9b4a75b24d1",
|
||||
"source_tree": "16623b1544bbe4186d85a067573d33e569389883"
|
||||
},
|
||||
"invocation": {
|
||||
"finished_on": "2026-10-24T20:07:27Z",
|
||||
"id": "sha256:7255e94d45a10b9c20cd9776863ac431aaacd92d358b88f5df5814f3266427f1",
|
||||
"started_on": "2026-10-24T20:07:27Z"
|
||||
"finished_on": "2026-11-24T21:39:14Z",
|
||||
"id": "sha256:e5deeb4cec56490f5a5fd49450057ffe2951a32c9d317bba7ad6bb927a35c33b",
|
||||
"started_on": "2026-11-24T21:39:14Z"
|
||||
},
|
||||
"resolved_dependencies": [
|
||||
{
|
||||
"digest": "sha256:563dcc817080aba9ab9833f3944377a4648806dd2de5e17d6e7e3ed999126dba",
|
||||
"digest": "sha256:5fe7528ba4fafe64153bafd4f145ff39a8d2663e0e953dfb2fe19dd122904d1b",
|
||||
"uri": "contract:h3-context-contract-inventory/1"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -127,6 +127,7 @@
|
||||
"frontend/tests/nleMediaBinDecorationCount.test.tsx",
|
||||
"frontend/tests/nleMediaRebind.test.ts",
|
||||
"frontend/tests/publicAssetManifestSharing.test.ts",
|
||||
"frontend/tests/syntheticMediaFontBounds.test.ts",
|
||||
"governance/contracts/supply_chain_v1.json",
|
||||
"tests/test_m25_45_derivative_table_parity.py"
|
||||
],
|
||||
@@ -163,6 +164,7 @@
|
||||
"frontend/tests/authoringOutputActions.test.ts",
|
||||
"frontend/tests/authoringOutputCodec.test.ts",
|
||||
"frontend/tests/authoringOutputLifecycle.test.tsx",
|
||||
"frontend/tests/authoringOutputPathRefusal.test.tsx",
|
||||
"frontend/tests/authoringOutputPreview.test.ts",
|
||||
"frontend/tests/e2e/helpers/mediaRuntimeDouble.ts",
|
||||
"frontend/tests/e2e/helpers/nleImportFixture.ts",
|
||||
@@ -321,10 +323,13 @@
|
||||
"frontend/src/host/appModeContract.ts",
|
||||
"frontend/src/host/appModeManagedPreparation.ts",
|
||||
"frontend/src/host/comfyPromptHistory.ts",
|
||||
"frontend/src/host/managedSequenceAuthority.ts",
|
||||
"frontend/src/host/managedSequenceClient.ts",
|
||||
"frontend/src/host/managedSequenceRunner.ts",
|
||||
"frontend/src/host/ownedGraphIdentity.ts",
|
||||
"frontend/src/host/preparedSequenceGraph.ts",
|
||||
"frontend/src/host/productionManagedChildResolver.ts",
|
||||
"frontend/src/host/sequenceMediaBindings.ts",
|
||||
"frontend/src/host/sidebarHost.ts",
|
||||
"frontend/src/runtime/embeddedAudioFollower.ts",
|
||||
"frontend/src/runtime/mediaCapabilities.ts",
|
||||
@@ -427,6 +432,7 @@
|
||||
"frontend/tests/e2e/journeys/m25_77ClipAudioParity.spec.ts",
|
||||
"frontend/tests/e2e/journeys/mediaSourceLeases.spec.ts",
|
||||
"frontend/tests/e2e/journeys/titleInsertion.spec.ts",
|
||||
"frontend/tests/e2e/journeys/titleStylePresets.spec.ts",
|
||||
"frontend/tests/e2e/journeys/wipeTransitions.spec.ts",
|
||||
"frontend/tests/editorRuntime.test.ts",
|
||||
"frontend/tests/editorRuntimeAdmission.test.ts",
|
||||
@@ -443,6 +449,7 @@
|
||||
"frontend/tests/nleMediaBinDecorationCount.test.tsx",
|
||||
"frontend/tests/nleMediaRebind.test.ts",
|
||||
"frontend/tests/nleSceneResolutionAudioExclusion.test.ts",
|
||||
"frontend/tests/nleTextPresets.test.ts",
|
||||
"frontend/tests/nleTimelineClipSurface.test.tsx",
|
||||
"frontend/tests/nleTimelineGesture.test.ts",
|
||||
"frontend/tests/nleTimelineSurface.test.ts",
|
||||
@@ -597,9 +604,9 @@
|
||||
"boundary": "cross_language",
|
||||
"compatibility": "migration_required",
|
||||
"consumers": [
|
||||
"frontend/src/host/appMode.ts",
|
||||
"frontend/src/host/appModeAdmission.ts",
|
||||
"frontend/src/host/appModeContract.ts",
|
||||
"frontend/src/host/appModeProfileAdmission.ts",
|
||||
"frontend/src/host/generationProfileClient.ts",
|
||||
"frontend/src/host/officialAssetResolution.ts",
|
||||
"frontend/tests/e2e/host/assets.ts",
|
||||
@@ -613,6 +620,7 @@
|
||||
"frontend/tests/e2e/journeys/host/connectedMedia.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/contextSetup.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/frameAuthority.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/geometryInvariants.ts",
|
||||
"frontend/tests/e2e/journeys/host/guideReadiness.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/managedArtifacts.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/materialization.spec.ts",
|
||||
@@ -694,6 +702,7 @@
|
||||
"frontend/src/lifecycle/nleWorkspaceSession.ts",
|
||||
"frontend/src/state/nleWorkspaceState.ts",
|
||||
"frontend/tests/managedQualification.test.ts",
|
||||
"frontend/tests/nativeSourceCopy.test.ts",
|
||||
"frontend/tests/nleSequencePanelControls.test.tsx",
|
||||
"frontend/tests/plainProductCopy.test.tsx",
|
||||
"governance/contracts/supply_chain_v1.json"
|
||||
@@ -920,6 +929,7 @@
|
||||
"frontend/src/host/productionPlanningActions.ts",
|
||||
"frontend/src/lifecycle/nleWorkspacePlanning.ts",
|
||||
"frontend/src/state/nleWorkspaceState.ts",
|
||||
"frontend/tests/e2e/journeys/host/frameModeSequences.spec.ts",
|
||||
"frontend/tests/managedQualification.test.ts",
|
||||
"frontend/tests/nleSequencePanelControls.test.tsx",
|
||||
"frontend/tests/productionPlanningActions.test.ts",
|
||||
@@ -967,6 +977,7 @@
|
||||
"frontend/src/lifecycle/shellSession.ts",
|
||||
"frontend/tests/e2e/host/productionRuntimeProducer.ts",
|
||||
"frontend/tests/e2e/host/productionRuntimeRow.ts",
|
||||
"frontend/tests/e2e/journeys/host/frameModeSequences.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/managedArtifactPrivateRoot.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/managedTerminalWaiting.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/nleCausalJourney.spec.ts",
|
||||
@@ -1388,6 +1399,8 @@
|
||||
"comfyui_h3_context/adapters/comfyui_generation_profile.py",
|
||||
"comfyui_h3_context/core/compatibility.py",
|
||||
"comfyui_h3_context/core/generation_profile.py",
|
||||
"comfyui_h3_context/core/native_baseline_v0_44.py",
|
||||
"comfyui_h3_context/core/native_keyframe_baseline.py",
|
||||
"comfyui_h3_context/core/native_t2va_baseline.py",
|
||||
"comfyui_h3_context/core/native_t2va_structure.py",
|
||||
"comfyui_h3_context/core/product_shell.py",
|
||||
@@ -1403,15 +1416,21 @@
|
||||
"frontend/src/host/graphSerialization.ts",
|
||||
"frontend/src/host/graphSubgraphLinks.ts",
|
||||
"frontend/src/host/graphTopology.ts",
|
||||
"frontend/src/host/preparedSequenceGraph.ts",
|
||||
"frontend/src/host/preparedSequenceObservation.ts",
|
||||
"frontend/src/host/sequenceFrameMaterialization.ts",
|
||||
"frontend/src/host/templateGraphTopology.ts",
|
||||
"frontend/src/host/templateMaterialization.ts",
|
||||
"frontend/tests/H3Sidebar.test.tsx",
|
||||
"frontend/tests/appMode.test.ts",
|
||||
"frontend/tests/connectRoute.test.ts",
|
||||
"frontend/tests/cropWeightSampleGeometry.test.ts",
|
||||
"frontend/tests/e2e/host/frameModeSequence.ts",
|
||||
"frontend/tests/e2e/journeys/host/connectedMedia.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/existingRoutePreview.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/frameAuthority.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/frameModeSequences.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/geometry-readback.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/guideReadiness.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/imageCrop.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/m25_08CausalClipEditor.spec.ts",
|
||||
@@ -1426,6 +1445,7 @@
|
||||
"frontend/tests/e2e/journeys/refusalReasons.spec.ts",
|
||||
"frontend/tests/entryWorkspaceLifecycle.test.tsx",
|
||||
"frontend/tests/fixtures/entryHostModules.ts",
|
||||
"frontend/tests/fixtures/managedT2vaGraph.json",
|
||||
"frontend/tests/graphAdapter.test.ts",
|
||||
"frontend/tests/hermeticExecution.test.ts",
|
||||
"frontend/tests/imageCropSidebar.test.tsx",
|
||||
@@ -1435,8 +1455,12 @@
|
||||
"frontend/tests/managedAppMode.test.ts",
|
||||
"frontend/tests/materializedGraphAdmission.test.ts",
|
||||
"frontend/tests/ownedGraphIdentity.test.ts",
|
||||
"frontend/tests/preparedSequenceObservation.test.ts",
|
||||
"frontend/tests/preparedSequenceTemplateGeometry.test.ts",
|
||||
"frontend/tests/productionManagedChildResolver.test.ts",
|
||||
"frontend/tests/refusalReasons.test.ts",
|
||||
"frontend/tests/sequenceCanvasParity.test.ts",
|
||||
"frontend/tests/sequenceFrameMaterialization.test.ts",
|
||||
"frontend/tests/shellState.test.ts",
|
||||
"frontend/tests/sidebarHost.test.ts",
|
||||
"frontend/tests/support/connectFixture.ts",
|
||||
@@ -1446,6 +1470,7 @@
|
||||
"frontend/tests/support/hostBehaviourCatalogue.ts",
|
||||
"frontend/tests/support/hostSeamLiveProbe.ts",
|
||||
"frontend/tests/support/managedHostGraphFixture.ts",
|
||||
"frontend/tests/support/preparedSequenceTemplateGeometryFixture.ts",
|
||||
"frontend/tests/support/qualifiedBasePrompt.ts",
|
||||
"frontend/tests/support/templateFixture.ts",
|
||||
"frontend/tests/surroundingsDiff.test.ts",
|
||||
@@ -1468,6 +1493,7 @@
|
||||
"tests/fixtures/m14_05_fixed_h3_generation.json",
|
||||
"tests/fixtures/m15_05_native_mode_matrix.json",
|
||||
"tests/fixtures/m16_01_source_requalification.json",
|
||||
"tests/fixtures/managed_t2va_baseline.json",
|
||||
"tests/native_t2va_fixtures.py",
|
||||
"tests/test_base_assistant_subgraph.py",
|
||||
"tests/test_compatibility.py",
|
||||
@@ -1479,6 +1505,7 @@
|
||||
"tests/test_m17_14_production_closeout.py",
|
||||
"tests/test_native_composition.py",
|
||||
"tests/test_native_h3_adapter.py",
|
||||
"tests/test_native_keyframe_structure.py",
|
||||
"tests/test_native_mode_matrix.py",
|
||||
"tests/test_native_source_compatibility.py",
|
||||
"tests/test_native_t2va_structure.py",
|
||||
@@ -1544,6 +1571,7 @@
|
||||
"frontend/tests/e2e/host/referenceMaximumOrder.ts",
|
||||
"frontend/tests/e2e/journeys/host/audioComposition.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/contentExtentHost.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/frameModeSequences.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/imageCrop.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/m25_08CausalClipEditor.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/m25_45LargeSharpPreview.spec.ts",
|
||||
@@ -1673,10 +1701,12 @@
|
||||
"scripts/change_lane.py",
|
||||
"scripts/derived_artifacts.py",
|
||||
"scripts/frontend_build_report.py",
|
||||
"scripts/repair_prefreeze_check.py",
|
||||
"scripts/supply_chain_manifest.py",
|
||||
"tests/fixtures/m23_48_derived_artifact_graph_v1.json",
|
||||
"tests/test_build_provenance.py",
|
||||
"tests/test_m23_48_derived_artifacts.py",
|
||||
"tests/test_repair_prefreeze_check.py",
|
||||
"tests/test_tooling_contract.py"
|
||||
],
|
||||
"contract_id": "h3-context-build-provenance/1",
|
||||
@@ -1913,14 +1943,17 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/candidateBundleHarness.test.ts",
|
||||
"governance/contracts/supply_chain_v1.schema.json",
|
||||
"scripts/change_lane.py",
|
||||
"scripts/derived_artifacts.py",
|
||||
"scripts/governance/relocate_packaged_artifacts.py",
|
||||
"scripts/repair_prefreeze_check.py",
|
||||
"scripts/supply_chain_manifest.py",
|
||||
"scripts/validate_comfy_registry_metadata.py",
|
||||
"tests/fixtures/m23_48_derived_artifact_graph_v1.json",
|
||||
"tests/test_build_provenance.py",
|
||||
"tests/test_repair_prefreeze_check.py",
|
||||
"tests/test_supply_chain_manifest.py"
|
||||
],
|
||||
"contract_id": "h3-context-supply-chain/1",
|
||||
@@ -2145,8 +2178,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition.v1",
|
||||
@@ -2161,6 +2194,30 @@
|
||||
],
|
||||
"publication": "repository_only"
|
||||
},
|
||||
{
|
||||
"authority_paths": [
|
||||
"governance/contracts/host_seam_census_transition_frame_sources_v1.json"
|
||||
],
|
||||
"blockers": [],
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_frame_sources.v1",
|
||||
"dialect": "not_applicable",
|
||||
"disposition": "KEEP",
|
||||
"evidence": "untrusted_input boundary keeps a reader this repository cannot re-migrate",
|
||||
"fingerprint_domain": "none",
|
||||
"kind": "json_data",
|
||||
"persistence": "persisted",
|
||||
"producers": [
|
||||
"governance/contracts/host_seam_census_transition_frame_sources_v1.json"
|
||||
],
|
||||
"publication": "repository_only"
|
||||
},
|
||||
{
|
||||
"authority_paths": [
|
||||
"governance/contracts/host_seam_census_transition_m16_05_v1.json"
|
||||
@@ -2169,8 +2226,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_m16_05.v1",
|
||||
@@ -2193,8 +2250,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_m16_05_release.v1",
|
||||
@@ -2217,8 +2274,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_m23_18.v1",
|
||||
@@ -2241,8 +2298,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_m23_19.v1",
|
||||
@@ -2265,8 +2322,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_m23_24.v1",
|
||||
@@ -2289,8 +2346,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_m23_25.v1",
|
||||
@@ -2313,8 +2370,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_m23_28.v1",
|
||||
@@ -2337,8 +2394,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_m23_47.v1",
|
||||
@@ -2361,8 +2418,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_m25_02.v1",
|
||||
@@ -2385,8 +2442,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_m25_13.v1",
|
||||
@@ -2409,8 +2466,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_m25_16.v1",
|
||||
@@ -2433,8 +2490,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_m25_33.v1",
|
||||
@@ -2457,8 +2514,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_m25_38.v1",
|
||||
@@ -2481,8 +2538,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_m26_03.v1",
|
||||
@@ -2505,8 +2562,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_m26_04.v1",
|
||||
@@ -2529,8 +2586,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_managed_qualification.v1",
|
||||
@@ -2553,8 +2610,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_modal_keyboard.v1",
|
||||
@@ -2577,8 +2634,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_perception_host.v1",
|
||||
@@ -2601,8 +2658,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_project_persistence.v1",
|
||||
@@ -2626,6 +2683,7 @@
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_reference_crop.v1",
|
||||
@@ -2648,8 +2706,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_retained_media.v1",
|
||||
@@ -2672,8 +2730,8 @@
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_census_transition_workspace_state.v1",
|
||||
@@ -2698,6 +2756,7 @@
|
||||
"consumers": [
|
||||
"frontend/tests/e2e/journeys/hostSeams/hc10HostSeamDrift.spec.ts",
|
||||
"frontend/tests/hostSeamDrift.test.ts",
|
||||
"frontend/tests/support/hostSeamCompatibility.ts",
|
||||
"frontend/tests/support/hostSeamDrift.ts"
|
||||
],
|
||||
"contract_id": "h3.context.host_seam_drift_baseline.v1",
|
||||
@@ -2825,7 +2884,8 @@
|
||||
"scripts/nle_hardening_manifest.py",
|
||||
"scripts/nle_semantic_conformance_manifest.py",
|
||||
"tests/test_m25_16_control_coverage.py",
|
||||
"tests/test_m25_render_conformance.py"
|
||||
"tests/test_m25_render_conformance.py",
|
||||
"tests/test_title_style_presets.py"
|
||||
],
|
||||
"contract_id": "h3.context.nle_control_coverage_manifest.v2",
|
||||
"dialect": "not_applicable",
|
||||
@@ -6778,6 +6838,7 @@
|
||||
"comfyui_h3_context/core/fixed_h3_generation.py",
|
||||
"governance/contracts/fixed_h3_generation_v1.schema.json",
|
||||
"tests/fixtures/m14_05_fixed_h3_generation.json",
|
||||
"tests/fixtures/managed_t2va_baseline.json",
|
||||
"tests/test_fixed_h3_generation.py",
|
||||
"tests/test_native_h3_adapter.py"
|
||||
],
|
||||
@@ -7157,6 +7218,7 @@
|
||||
"frontend/src/contracts/compositionCodec.ts",
|
||||
"frontend/tests/authoringWorkbenchCodec.test.ts",
|
||||
"frontend/tests/fixtures/m25_20_primary_without_audio_snapshot.json",
|
||||
"frontend/tests/fixtures/packagedTitlePreview.json",
|
||||
"frontend/tests/support/productionAuthoringImportFixture.ts",
|
||||
"tests/fixtures/m23_46_semantic_parity_v1.json",
|
||||
"tests/fixtures/m25_10_composition_contract_v1.json",
|
||||
@@ -7707,6 +7769,7 @@
|
||||
"comfyui_h3_context/core/nle_authoring_contract.py",
|
||||
"frontend/src/contracts/compositionCodec.ts",
|
||||
"frontend/tests/fixtures/m25_20_primary_without_audio_snapshot.json",
|
||||
"frontend/tests/fixtures/packagedTitlePreview.json",
|
||||
"tests/fixtures/m23_46_semantic_parity_v1.json",
|
||||
"tests/fixtures/m25_10_composition_contract_v1.json",
|
||||
"tests/fixtures/m25_16_scene_resolver_parity_v1.json",
|
||||
@@ -8895,8 +8958,10 @@
|
||||
"boundary": "cross_language",
|
||||
"compatibility": "migration_required",
|
||||
"consumers": [
|
||||
"comfyui_h3_context/adapters/sequence_media_observation.py",
|
||||
"frontend/src/host/appModeManagedPreparation.ts",
|
||||
"frontend/src/host/inputGeometry.ts",
|
||||
"frontend/src/host/sequenceMediaBindings.ts",
|
||||
"frontend/tests/appMode.test.ts",
|
||||
"frontend/tests/e2e/host/assets.ts",
|
||||
"frontend/tests/e2e/host/candidate.ts",
|
||||
@@ -8919,8 +8984,14 @@
|
||||
"frontend/tests/e2e/journeys/host/weightSample.spec.ts",
|
||||
"frontend/tests/inputGeometry.test.ts",
|
||||
"frontend/tests/managedAppMode.test.ts",
|
||||
"frontend/tests/nleWorkspaceSequence.test.ts",
|
||||
"frontend/tests/productionManagedChildResolver.test.ts",
|
||||
"frontend/tests/sequenceMediaBindings.test.ts",
|
||||
"frontend/tests/sequenceMediaCapture.test.ts",
|
||||
"frontend/tests/support/preparedSequenceMediaFixture.ts",
|
||||
"tests/test_m23_18_input_geometry.py",
|
||||
"tests/test_m23_29_observed_admission.py"
|
||||
"tests/test_m23_29_observed_admission.py",
|
||||
"tests/test_sequence_media_bindings.py"
|
||||
],
|
||||
"contract_id": "h3.context.input_geometry.receipt.v2",
|
||||
"dialect": "not_applicable",
|
||||
@@ -8947,9 +9018,11 @@
|
||||
"consumers": [
|
||||
"frontend/src/host/appModeManagedPreparation.ts",
|
||||
"frontend/src/host/inputGeometry.ts",
|
||||
"frontend/src/host/sequenceMediaCapture.ts",
|
||||
"frontend/tests/e2e/journeys/host/minimalAdmission.spec.ts",
|
||||
"frontend/tests/inputGeometry.test.ts",
|
||||
"frontend/tests/managedAppMode.test.ts",
|
||||
"frontend/tests/sequenceMediaCapture.test.ts",
|
||||
"tests/test_m23_15_sequence_coordinator.py",
|
||||
"tests/test_m23_18_input_geometry.py",
|
||||
"tests/test_m23_29_observed_admission.py",
|
||||
@@ -8977,6 +9050,7 @@
|
||||
"boundary": "process_local",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"tests/fixtures/managed_t2va_baseline.json",
|
||||
"tests/test_m24_05_authority_migration.py",
|
||||
"tests/test_m24_05_scoped_intent.py"
|
||||
],
|
||||
@@ -9602,6 +9676,7 @@
|
||||
"consumers": [
|
||||
"frontend/src/host/productionManagedChildResolver.ts",
|
||||
"frontend/tests/productionManagedChildResolver.test.ts",
|
||||
"tests/fixtures/managed_t2va_baseline.json",
|
||||
"tests/test_m26_03_prepared_context.py"
|
||||
],
|
||||
"contract_id": "h3.context.managed_prepared_context.v1",
|
||||
@@ -9618,6 +9693,32 @@
|
||||
"reachability": "reachable",
|
||||
"reachability_source": "host_input"
|
||||
},
|
||||
{
|
||||
"authority_paths": [
|
||||
"comfyui_h3_context/adapters/managed_sequence_service.py"
|
||||
],
|
||||
"blockers": [],
|
||||
"boundary": "cross_language",
|
||||
"compatibility": "migration_required",
|
||||
"consumers": [
|
||||
"frontend/src/host/productionManagedChildResolver.ts",
|
||||
"frontend/tests/productionManagedChildResolver.test.ts",
|
||||
"tests/test_frame_mode_sequence_start.py"
|
||||
],
|
||||
"contract_id": "h3.context.managed_prepared_context.v2",
|
||||
"dialect": "not_applicable",
|
||||
"disposition": "KEEP",
|
||||
"evidence": "cross_language boundary keeps a reader this repository cannot re-migrate",
|
||||
"fingerprint_domain": "h3.context.managed_prepared_context.v2",
|
||||
"kind": "python_wire",
|
||||
"persistence": "transient",
|
||||
"producers": [
|
||||
"comfyui_h3_context/adapters/managed_sequence_service.py"
|
||||
],
|
||||
"publication": "packaged",
|
||||
"reachability": "reachable",
|
||||
"reachability_source": "host_input"
|
||||
},
|
||||
{
|
||||
"authority_paths": [
|
||||
"comfyui_h3_context/adapters/managed_sequence_service.py"
|
||||
@@ -9723,7 +9824,8 @@
|
||||
"tests/test_coordinator_artifact_concurrency.py",
|
||||
"tests/test_m23_51_release_route_contract.py",
|
||||
"tests/test_m25_35_production_membership.py",
|
||||
"tests/test_managed_generation_publication_bridge.py"
|
||||
"tests/test_managed_generation_publication_bridge.py",
|
||||
"tests/test_managed_sequence_canvas.py"
|
||||
],
|
||||
"contract_id": "h3.context.managed_run_release_request.v2",
|
||||
"dialect": "not_applicable",
|
||||
@@ -10016,7 +10118,8 @@
|
||||
"frontend/src/host/managedSequenceClient.ts",
|
||||
"frontend/tests/appModeManagedSequenceIntegration.test.ts",
|
||||
"frontend/tests/managedSequence.test.ts",
|
||||
"frontend/tests/managedSequenceRecovery.test.ts"
|
||||
"frontend/tests/managedSequenceRecovery.test.ts",
|
||||
"frontend/tests/sequenceMediaResults.test.ts"
|
||||
],
|
||||
"contract_id": "h3.context.managed_sequence_result.v1",
|
||||
"dialect": "not_applicable",
|
||||
@@ -10032,6 +10135,34 @@
|
||||
"reachability": "reachable",
|
||||
"reachability_source": "host_input"
|
||||
},
|
||||
{
|
||||
"authority_paths": [
|
||||
"comfyui_h3_context/adapters/managed_sequence_service.py"
|
||||
],
|
||||
"blockers": [],
|
||||
"boundary": "cross_language",
|
||||
"compatibility": "migration_required",
|
||||
"consumers": [
|
||||
"frontend/src/host/managedSequenceClient.ts",
|
||||
"frontend/src/host/managedSequenceRunner.ts",
|
||||
"frontend/tests/managedSequence.test.ts",
|
||||
"frontend/tests/sequenceMediaResults.test.ts",
|
||||
"tests/test_sequence_media_results.py"
|
||||
],
|
||||
"contract_id": "h3.context.managed_sequence_result.v2",
|
||||
"dialect": "not_applicable",
|
||||
"disposition": "KEEP",
|
||||
"evidence": "cross_language boundary keeps a reader this repository cannot re-migrate",
|
||||
"fingerprint_domain": "h3.context.managed_sequence_result.v2",
|
||||
"kind": "python_wire",
|
||||
"persistence": "transient",
|
||||
"producers": [
|
||||
"comfyui_h3_context/adapters/managed_sequence_service.py"
|
||||
],
|
||||
"publication": "packaged",
|
||||
"reachability": "reachable",
|
||||
"reachability_source": "host_input"
|
||||
},
|
||||
{
|
||||
"authority_paths": [
|
||||
"comfyui_h3_context/core/managed_sequence.py"
|
||||
@@ -10615,6 +10746,39 @@
|
||||
"reachability": "reachable",
|
||||
"reachability_source": "host_input"
|
||||
},
|
||||
{
|
||||
"authority_paths": [
|
||||
"comfyui_h3_context/adapters/sequence_media_observation.py"
|
||||
],
|
||||
"blockers": [],
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"comfyui_h3_context/adapters/comfyui_sequence_coordinator.py",
|
||||
"comfyui_h3_context/adapters/managed_sequence_service.py",
|
||||
"frontend/src/host/appModeContract.ts",
|
||||
"frontend/src/host/appModeManagedPreparation.ts",
|
||||
"frontend/tests/compiledPromptIsolation.test.ts",
|
||||
"frontend/tests/managedAppMode.test.ts",
|
||||
"frontend/tests/preparedSequenceController.test.ts",
|
||||
"tests/test_managed_sequence_canvas.py",
|
||||
"tests/test_sequence_media_observation.py",
|
||||
"tests/test_sequence_media_results.py"
|
||||
],
|
||||
"contract_id": "h3.context.prepared_graph_observation.v5",
|
||||
"dialect": "not_applicable",
|
||||
"disposition": "KEEP",
|
||||
"evidence": "untrusted_input boundary keeps a reader this repository cannot re-migrate",
|
||||
"fingerprint_domain": "h3.context.prepared_graph_observation.v5",
|
||||
"kind": "python_wire",
|
||||
"persistence": "transient",
|
||||
"producers": [
|
||||
"comfyui_h3_context/adapters/sequence_media_observation.py"
|
||||
],
|
||||
"publication": "packaged",
|
||||
"reachability": "reachable",
|
||||
"reachability_source": "host_input"
|
||||
},
|
||||
{
|
||||
"authority_paths": [
|
||||
"comfyui_h3_context/core/composition_contract.py"
|
||||
@@ -10912,11 +11076,16 @@
|
||||
"consumers": [
|
||||
"frontend/src/host/appMode.ts",
|
||||
"frontend/src/host/appModeContract.ts",
|
||||
"frontend/src/host/preparedCanonicalStart.ts",
|
||||
"frontend/src/host/productionManagedChildResolver.ts",
|
||||
"frontend/tests/existingRouteAdmission.test.ts",
|
||||
"frontend/tests/preparedSequenceController.test.ts",
|
||||
"frontend/tests/preparedSequenceStart.test.ts",
|
||||
"frontend/tests/preparedSequenceUnicode.test.ts",
|
||||
"frontend/tests/productionCanonicalLowering.test.ts",
|
||||
"frontend/tests/productionManagedChildResolver.test.ts",
|
||||
"frontend/tests/referenceOwnership.test.ts",
|
||||
"tests/fixtures/managed_t2va_baseline.json",
|
||||
"tests/test_m26_03_prepared_context.py"
|
||||
],
|
||||
"contract_id": "h3.context.production_canonical_lowering.v1",
|
||||
@@ -10933,6 +11102,38 @@
|
||||
"reachability": "reachable",
|
||||
"reachability_source": "host_input"
|
||||
},
|
||||
{
|
||||
"authority_paths": [
|
||||
"comfyui_h3_context/adapters/production_context_materializer.py"
|
||||
],
|
||||
"blockers": [],
|
||||
"boundary": "cross_language",
|
||||
"compatibility": "migration_required",
|
||||
"consumers": [
|
||||
"frontend/src/host/appModeContract.ts",
|
||||
"frontend/src/host/preparedCanonicalStart.ts",
|
||||
"frontend/src/host/productionManagedChildResolver.ts",
|
||||
"frontend/tests/preparedSequenceController.test.ts",
|
||||
"frontend/tests/preparedSequenceStart.test.ts",
|
||||
"frontend/tests/preparedSequenceUnicode.test.ts",
|
||||
"frontend/tests/productionCanonicalLowering.test.ts",
|
||||
"frontend/tests/productionManagedChildResolver.test.ts",
|
||||
"tests/test_frame_canonical_lowering.py"
|
||||
],
|
||||
"contract_id": "h3.context.production_canonical_lowering.v2",
|
||||
"dialect": "not_applicable",
|
||||
"disposition": "KEEP",
|
||||
"evidence": "cross_language boundary keeps a reader this repository cannot re-migrate",
|
||||
"fingerprint_domain": "h3.context.production_canonical_lowering.v2",
|
||||
"kind": "python_wire",
|
||||
"persistence": "transient",
|
||||
"producers": [
|
||||
"comfyui_h3_context/adapters/production_context_materializer.py"
|
||||
],
|
||||
"publication": "packaged",
|
||||
"reachability": "reachable",
|
||||
"reachability_source": "host_input"
|
||||
},
|
||||
{
|
||||
"authority_paths": [
|
||||
"comfyui_h3_context/core/production_import.py"
|
||||
@@ -11341,7 +11542,10 @@
|
||||
"frontend/tests/productionActions.test.ts",
|
||||
"frontend/tests/productionWorkbenchCodec.test.ts",
|
||||
"scripts/m25_16_import_fixture.py",
|
||||
"tests/test_canonical_global_label_binding.py",
|
||||
"tests/test_coordinator_artifact_concurrency.py",
|
||||
"tests/test_frame_sequence_readiness_start.py",
|
||||
"tests/test_full_reference_frame_ownership.py",
|
||||
"tests/test_import_fixture_media_source.py",
|
||||
"tests/test_m17_14_production_closeout.py",
|
||||
"tests/test_m23_15_sequence_coordinator.py",
|
||||
@@ -11359,6 +11563,7 @@
|
||||
"tests/test_m26_08_reference_bearing_planning.py",
|
||||
"tests/test_managed_artifact_runtime.py",
|
||||
"tests/test_managed_generation_publication_bridge.py",
|
||||
"tests/test_managed_sequence_canvas.py",
|
||||
"tests/test_media_preview.py",
|
||||
"tests/test_product_shell_node.py",
|
||||
"tests/test_production_import.py",
|
||||
@@ -11774,6 +11979,7 @@
|
||||
"frontend/src/contracts/compositionCodec.ts",
|
||||
"frontend/tests/compositionContract.test.ts",
|
||||
"frontend/tests/fixtures/m25_20_primary_without_audio_snapshot.json",
|
||||
"frontend/tests/fixtures/packagedTitlePreview.json",
|
||||
"tests/fixtures/m23_46_semantic_parity_v1.json",
|
||||
"tests/fixtures/m25_10_composition_contract_v1.json",
|
||||
"tests/fixtures/m25_16_scene_resolver_parity_v1.json",
|
||||
@@ -12414,6 +12620,40 @@
|
||||
],
|
||||
"publication": "packaged"
|
||||
},
|
||||
{
|
||||
"authority_paths": [
|
||||
"comfyui_h3_context/adapters/sequence_media_bindings.py"
|
||||
],
|
||||
"blockers": [],
|
||||
"boundary": "untrusted_input",
|
||||
"compatibility": "old_readers_unaffected",
|
||||
"consumers": [
|
||||
"frontend/src/host/sequenceMediaBindings.ts",
|
||||
"frontend/src/host/sequenceMediaCapture.ts",
|
||||
"frontend/tests/nleWorkspaceSequence.test.ts",
|
||||
"frontend/tests/productionManagedChildResolver.test.ts",
|
||||
"frontend/tests/sequenceMediaBindings.test.ts",
|
||||
"frontend/tests/support/preparedSequenceMediaFixture.ts",
|
||||
"tests/test_frame_mode_sequence_start.py",
|
||||
"tests/test_frame_sequence_readiness_start.py",
|
||||
"tests/test_managed_sequence_canvas.py",
|
||||
"tests/test_sequence_media_bindings.py",
|
||||
"tests/test_sequence_media_maximum_envelope.py"
|
||||
],
|
||||
"contract_id": "h3.context.sequence_media_binding_set.v1",
|
||||
"dialect": "not_applicable",
|
||||
"disposition": "KEEP",
|
||||
"evidence": "untrusted_input boundary keeps a reader this repository cannot re-migrate",
|
||||
"fingerprint_domain": "h3.context.sequence_media_binding_set.v1",
|
||||
"kind": "python_wire",
|
||||
"persistence": "transient",
|
||||
"producers": [
|
||||
"comfyui_h3_context/adapters/sequence_media_bindings.py"
|
||||
],
|
||||
"publication": "packaged",
|
||||
"reachability": "reachable",
|
||||
"reachability_source": "host_input"
|
||||
},
|
||||
{
|
||||
"authority_paths": [
|
||||
"comfyui_h3_context/adapters/comfyui_sidebar_workspace.py"
|
||||
@@ -12428,7 +12668,9 @@
|
||||
"governance/contracts/sidebar_action_v2.schema.json",
|
||||
"tests/test_assisted_hard_content.py",
|
||||
"tests/test_assisted_prompt_proposal.py",
|
||||
"tests/test_canonical_global_label_binding.py",
|
||||
"tests/test_comfyui_assisted_draft.py",
|
||||
"tests/test_full_reference_frame_ownership.py",
|
||||
"tests/test_instruction_refinement.py",
|
||||
"tests/test_m26_03_planning_atomicity.py",
|
||||
"tests/test_m26_03_planning_source.py",
|
||||
@@ -13667,6 +13909,50 @@
|
||||
],
|
||||
"publication": "packaged"
|
||||
},
|
||||
{
|
||||
"authority_paths": [
|
||||
"comfyui_h3_context/core/native_keyframe_structure.py"
|
||||
],
|
||||
"blockers": [
|
||||
"unknown_consumer"
|
||||
],
|
||||
"boundary": "persisted",
|
||||
"compatibility": "migration_required",
|
||||
"consumers": [],
|
||||
"contract_id": "h3.native_keyframe_baseline_manifest.v1",
|
||||
"dialect": "not_applicable",
|
||||
"disposition": "NEED_EVIDENCE",
|
||||
"evidence": "no reader resolved by the five discovery rules; absence is not disuse",
|
||||
"fingerprint_domain": "h3.native_keyframe_baseline_manifest.v1",
|
||||
"kind": "python_wire",
|
||||
"persistence": "persisted",
|
||||
"producers": [
|
||||
"comfyui_h3_context/core/native_keyframe_structure.py"
|
||||
],
|
||||
"publication": "packaged"
|
||||
},
|
||||
{
|
||||
"authority_paths": [
|
||||
"comfyui_h3_context/core/native_keyframe_structure.py"
|
||||
],
|
||||
"blockers": [
|
||||
"unknown_consumer"
|
||||
],
|
||||
"boundary": "process_local",
|
||||
"compatibility": "unknown",
|
||||
"consumers": [],
|
||||
"contract_id": "h3.native_keyframe_structure.v1",
|
||||
"dialect": "not_applicable",
|
||||
"disposition": "NEED_EVIDENCE",
|
||||
"evidence": "no reader resolved by the five discovery rules; absence is not disuse",
|
||||
"fingerprint_domain": "h3.native_keyframe_structure.v1",
|
||||
"kind": "python_wire",
|
||||
"persistence": "transient",
|
||||
"producers": [
|
||||
"comfyui_h3_context/core/native_keyframe_structure.py"
|
||||
],
|
||||
"publication": "packaged"
|
||||
},
|
||||
{
|
||||
"authority_paths": [
|
||||
"comfyui_h3_context/core/native_mode_matrix.py"
|
||||
@@ -15267,6 +15553,7 @@
|
||||
"comfyui_h3_context/core/public_manifest.py",
|
||||
"comfyui_h3_context/core/workflow_migration_subgraph.py",
|
||||
"frontend/tests/e2e/host/execution.ts",
|
||||
"frontend/tests/e2e/host/frameModeSequence.ts",
|
||||
"frontend/tests/e2e/journeys/host/contextSetup.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/managedArtifactPrivateRoot.spec.ts",
|
||||
"frontend/tests/e2e/journeys/host/managedParentQualification.spec.ts",
|
||||
@@ -15599,6 +15886,6 @@
|
||||
"reachability_source": "none"
|
||||
}
|
||||
],
|
||||
"fingerprint": "sha256:563dcc817080aba9ab9833f3944377a4648806dd2de5e17d6e7e3ed999126dba",
|
||||
"fingerprint": "sha256:5fe7528ba4fafe64153bafd4f145ff39a8d2663e0e953dfb2fe19dd122904d1b",
|
||||
"schema": "h3-context-contract-inventory/1"
|
||||
}
|
||||
|
||||
@@ -134,8 +134,8 @@
|
||||
"authority": "observed.hc_09_pinned_host",
|
||||
"source_paths": [
|
||||
"frontend/src/entry.tsx",
|
||||
"frontend/src/host/appMode.ts",
|
||||
"frontend/src/host/appModeContract.ts",
|
||||
"frontend/src/host/appModeProfileAdmission.ts",
|
||||
"frontend/src/host/authoringActions.ts",
|
||||
"frontend/src/host/authoringMediaPreview.ts",
|
||||
"frontend/src/host/authoringMediaSourceLease.ts",
|
||||
@@ -331,7 +331,8 @@
|
||||
"source_paths": [
|
||||
"frontend/src/host/hostModuleTypes.ts",
|
||||
"frontend/src/host/hostSeams.ts",
|
||||
"frontend/src/host/sidebarHost.ts"
|
||||
"frontend/src/host/sidebarHost.ts",
|
||||
"frontend/src/lifecycle/nleWorkspaceSession.ts"
|
||||
],
|
||||
"readiness_states": [
|
||||
"ready",
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"profiles":[{"compatibility":["python>=3.10"],"distribution":"minimax-h3-studio==1.4.0","download_policy":"artifact_only","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"artifact","model_management":"none","owner":"package","profile_id":"core_manual","removal":"remove_package_owned_files","required":true,"rollback":"reinstall_previous_verified_artifact","runtime_entries":["comfyui_h3_context"],"storage_owner":"package"},{"compatibility":["comfyui-native-node-capabilities-v1","comfyui-frontend-extension-api-v1"],"distribution":"host-provided","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"host_reuse","model_management":"host_only","owner":"host","profile_id":"comfyui_native","removal":"leave_host_runtime_unchanged","required":true,"rollback":"restore_previous_verified_node_artifact","runtime_entries":["comfyui_h3_context"],"storage_owner":"host"},{"compatibility":["h3-context-ollama-qualification/1"],"distribution":"external-user-managed","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"external_runtime","model_management":"external_only","owner":"user","profile_id":"external_ollama","removal":"leave_external_runtime_unchanged","required":false,"rollback":"user_managed_external_rollback","runtime_entries":[],"storage_owner":"user"},{"compatibility":["openai-compatible-model-list-and-chat-v1"],"distribution":"external-user-managed","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"external_runtime","model_management":"external_only","owner":"user","profile_id":"external_openai_compatible_loopback","removal":"leave_external_runtime_unchanged","required":false,"rollback":"user_managed_external_rollback","runtime_entries":[],"storage_owner":"user"},{"compatibility":["openai-compatible-model-list-and-chat-v1"],"distribution":"third-party-service","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"remote_service","model_management":"provider_managed","owner":"provider","profile_id":"remote_openai_compatible_service","removal":"leave_remote_service_unchanged","required":false,"rollback":"revoke_session_consent_and_clear_selection","runtime_entries":[],"storage_owner":"provider"},{"compatibility":["anthropic-models-and-messages-v1"],"distribution":"third-party-service","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"remote_service","model_management":"provider_managed","owner":"provider","profile_id":"remote_anthropic_service","removal":"leave_remote_service_unchanged","required":false,"rollback":"revoke_session_consent_and_clear_selection","runtime_entries":[],"storage_owner":"provider"},{"compatibility":["comfyui-frontend-extension-api-v1"],"distribution":"bundled-with-minimax-h3-studio","download_policy":"artifact_only","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"bundled_asset","model_management":"none","owner":"package","profile_id":"frontend_extension","removal":"remove_package_owned_bundle","required":true,"rollback":"reinstall_previous_verified_artifact","runtime_entries":["comfyui_h3_context/web/h3-context-sidebar.js"],"storage_owner":"package"}],"schema":"h3-context-installation-profiles/1","version":1}
|
||||
{"profiles":[{"compatibility":["python>=3.10"],"distribution":"minimax-h3-studio==1.4.6","download_policy":"artifact_only","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"artifact","model_management":"none","owner":"package","profile_id":"core_manual","removal":"remove_package_owned_files","required":true,"rollback":"reinstall_previous_verified_artifact","runtime_entries":["comfyui_h3_context"],"storage_owner":"package"},{"compatibility":["comfyui-native-node-capabilities-v1","comfyui-frontend-extension-api-v1"],"distribution":"host-provided","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"host_reuse","model_management":"host_only","owner":"host","profile_id":"comfyui_native","removal":"leave_host_runtime_unchanged","required":true,"rollback":"restore_previous_verified_node_artifact","runtime_entries":["comfyui_h3_context"],"storage_owner":"host"},{"compatibility":["h3-context-ollama-qualification/1"],"distribution":"external-user-managed","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"external_runtime","model_management":"external_only","owner":"user","profile_id":"external_ollama","removal":"leave_external_runtime_unchanged","required":false,"rollback":"user_managed_external_rollback","runtime_entries":[],"storage_owner":"user"},{"compatibility":["openai-compatible-model-list-and-chat-v1"],"distribution":"external-user-managed","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"external_runtime","model_management":"external_only","owner":"user","profile_id":"external_openai_compatible_loopback","removal":"leave_external_runtime_unchanged","required":false,"rollback":"user_managed_external_rollback","runtime_entries":[],"storage_owner":"user"},{"compatibility":["openai-compatible-model-list-and-chat-v1"],"distribution":"third-party-service","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"remote_service","model_management":"provider_managed","owner":"provider","profile_id":"remote_openai_compatible_service","removal":"leave_remote_service_unchanged","required":false,"rollback":"revoke_session_consent_and_clear_selection","runtime_entries":[],"storage_owner":"provider"},{"compatibility":["anthropic-models-and-messages-v1"],"distribution":"third-party-service","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"remote_service","model_management":"provider_managed","owner":"provider","profile_id":"remote_anthropic_service","removal":"leave_remote_service_unchanged","required":false,"rollback":"revoke_session_consent_and_clear_selection","runtime_entries":[],"storage_owner":"provider"},{"compatibility":["comfyui-frontend-extension-api-v1"],"distribution":"bundled-with-minimax-h3-studio","download_policy":"artifact_only","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"bundled_asset","model_management":"none","owner":"package","profile_id":"frontend_extension","removal":"remove_package_owned_bundle","required":true,"rollback":"reinstall_previous_verified_artifact","runtime_entries":["comfyui_h3_context/web/h3-context-sidebar.js"],"storage_owner":"package"}],"schema":"h3-context-installation-profiles/1","version":1}
|
||||
|
||||
@@ -177,7 +177,7 @@ def derivative_byte_limit(kind: DerivativeKind) -> int:
|
||||
"filmstrip": 512 * 1024,
|
||||
"audio_peaks": 64 * 1024,
|
||||
"image_proxy": 16 * 1024 * 1024,
|
||||
"packaged_font_face": 1024 * 1024,
|
||||
"packaged_font_face": 12 * 1024 * 1024, # SC Bold 2.004: 8,543,168 bytes.
|
||||
}[kind]
|
||||
|
||||
|
||||
@@ -610,6 +610,7 @@ class VerifiedDerivative:
|
||||
byte_count: int
|
||||
audio_disposition: AudioDisposition
|
||||
geometry: MediaGeometry | None = None
|
||||
media_type: str | None = None
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
if (
|
||||
@@ -626,6 +627,10 @@ class VerifiedDerivative:
|
||||
or self.derivative.generator_profile_id != DERIVATIVE_PROFILE_ID
|
||||
):
|
||||
raise MediaLeaseError("stale")
|
||||
if self.media_type is not None and not (
|
||||
self.kind == "packaged_font_face" and self.media_type in {"font/ttf", "font/otf"}
|
||||
):
|
||||
raise MediaLeaseError("unsupported")
|
||||
require_fingerprint(self.asset_fingerprint)
|
||||
require_fingerprint(self.generator_fingerprint)
|
||||
# IMPORTANT: a body that simply does not fit the profile is a resource limit, at
|
||||
|
||||
@@ -75,6 +75,7 @@ _ERROR_STATUSES: Final = {
|
||||
"not_ready": 409,
|
||||
"resource_limit": 429,
|
||||
"runtime_unavailable": 503,
|
||||
"path_too_deep": 503,
|
||||
"preview_unavailable": 503,
|
||||
"internal_error": 500,
|
||||
}
|
||||
|
||||
@@ -294,6 +294,7 @@ class RenderJobFailure(str, Enum):
|
||||
STORE_UNAVAILABLE = "store_unavailable"
|
||||
SERVICE_CLOSED = "service_closed"
|
||||
RUNTIME_UNAVAILABLE = "runtime_unavailable"
|
||||
PATH_TOO_DEEP = "path_too_deep"
|
||||
|
||||
|
||||
_TERMINAL: Final = frozenset(
|
||||
|
||||
@@ -116,7 +116,7 @@ def build_default_installation_profiles() -> InstallationProfileManifest:
|
||||
profile_id="core_manual",
|
||||
owner="package",
|
||||
# IMPORTANT: match package and manifest versions; strict decoding rejects drift.
|
||||
distribution="minimax-h3-studio==1.4.0",
|
||||
distribution="minimax-h3-studio==1.4.6",
|
||||
compatibility=("python>=3.10",),
|
||||
required=True,
|
||||
install_mode="artifact",
|
||||
|
||||
@@ -27,6 +27,17 @@ MANAGED_SEQUENCE_CURRENT_PROJECTION_SCHEMA = "h3.context.managed_sequence_projec
|
||||
MAX_MANAGED_SEQUENCE_SEGMENTS = 15
|
||||
MAX_SEQUENCE_RECOVERY_ACTIONS = 8
|
||||
MAX_COORDINATOR_RESPONSE_BYTES = 8 * 1024
|
||||
MAX_SEQUENCE_MEDIA_BINDINGS = 3
|
||||
MAX_SEQUENCE_MEDIA_BINDING_BYTES = 4_096
|
||||
MAX_MANAGED_CANONICAL_PROMPT_CHARACTERS = 4_096
|
||||
MAX_PREPARED_CONTEXT_ENVELOPE_BYTES = 4_096
|
||||
# IMPORTANT: execution payloads need 3*4096 binding bytes + 4096*4 Unicode prompt bytes
|
||||
# + 4096 fixed-envelope bytes. Control/ledger responses retain their independent 8 KiB cap.
|
||||
MAX_PREPARED_CONTEXT_RESPONSE_BYTES = (
|
||||
MAX_SEQUENCE_MEDIA_BINDINGS * MAX_SEQUENCE_MEDIA_BINDING_BYTES
|
||||
+ MAX_MANAGED_CANONICAL_PROMPT_CHARACTERS * 4
|
||||
+ MAX_PREPARED_CONTEXT_ENVELOPE_BYTES
|
||||
)
|
||||
MAX_MANAGED_SEQUENCE_PROJECTION_BYTES = 64 * 1024
|
||||
MANAGED_SEQUENCE_IDLE_SECONDS = 900.0
|
||||
MANAGED_SEQUENCE_ABSOLUTE_SECONDS = 24.0 * 60.0 * 60.0
|
||||
|
||||
@@ -0,0 +1,348 @@
|
||||
"""Audited native structural baselines of one source shape: digests, never source text.
|
||||
|
||||
Shape ``split-latent``: the audited rows of the committed first lineage, with the empty-latent
|
||||
helper split into ``_av_latent`` plus its wrapper. Each table is derived from the native
|
||||
source at the revision it names; provenance identifies that audited input and is never
|
||||
compared with a loaded source. Generated by ``scripts/native_t2va_structure.py
|
||||
--host-root <root> --revision 2c75dc1b --shape split-latent --emit-lineage``.
|
||||
Regenerate only for a newly audited shape; these tables are part of managed qualification
|
||||
compiler identity.
|
||||
"""
|
||||
|
||||
from typing import TypedDict
|
||||
|
||||
|
||||
class _ManifestData(TypedDict):
|
||||
source_revision: str
|
||||
source_blob: str
|
||||
definitions: tuple[tuple[str, str], ...]
|
||||
constants: tuple[tuple[str, str], ...]
|
||||
package_roots: tuple[str, ...]
|
||||
required_imports: tuple[str, ...]
|
||||
from_bindings: tuple[tuple[str, str], ...]
|
||||
envelope_bindings: tuple[tuple[str, str], ...]
|
||||
protected_builtins: tuple[str, ...]
|
||||
external_paths: tuple[str, ...]
|
||||
|
||||
|
||||
T2VA_DATA: _ManifestData = {
|
||||
"source_revision": "2c75dc1b379a59e0880619d029607af5169a62ef", # pragma: allowlist secret
|
||||
"source_blob": "b0abbc717ba6af7da5169f44467f44364468cda9", # pragma: allowlist secret
|
||||
"definitions": (
|
||||
(
|
||||
"align_frame_count",
|
||||
"sha256:815144140ac0f0c20a42a56f1168ca3086485456a52b4cb552b1d84c362c5cd3",
|
||||
),
|
||||
(
|
||||
"video_latent_t",
|
||||
"sha256:ddbe78607984329c205ec059fbad8114c5055e2a639c64cb7aceeb685316b0af",
|
||||
),
|
||||
(
|
||||
"temporal_shape",
|
||||
"sha256:5632544f143ed19e2cda997c2493292317d42bd117c572a4cb0bdf0e1c60b86f",
|
||||
),
|
||||
(
|
||||
"_av_latent",
|
||||
"sha256:69cca94829c012d7bc5985d7da95a41dda0764e2c307ebe5beda0d422c3554b0",
|
||||
),
|
||||
(
|
||||
"_empty_av_latent",
|
||||
"sha256:6e32805a47da3743c4e10aaeb91de9cd52b7564a328f10765f46fc598e5b9488",
|
||||
),
|
||||
(
|
||||
"EmptyMiniMaxH3LatentAV",
|
||||
"sha256:86eada1c51a9b09e633bb3404517041df858963f8873a914b042883f0005d717",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3SigmaShift",
|
||||
"sha256:6cb500867f47b7a0c6498d5cf564663d079ce1ac60bde13ab3a23b947248cbc6",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3ImageToVideo.define_schema",
|
||||
"sha256:48dbcd4e98c2b9afa141e3087700d870a385f9d901591489efe0b364abbb2857",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3ImageToVideo.execute",
|
||||
"sha256:d7477fcff0fe777655379476c4d1ff93b92caa5ba181adf7d72fad102241490c",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3ImageToVideo",
|
||||
"sha256:2e4cc7007bbbcc5727c4e0926955e61905cd8b4a0baab005eab2cde44e930c68",
|
||||
),
|
||||
),
|
||||
"constants": (
|
||||
(
|
||||
"CANVAS_MULTIPLE",
|
||||
"sha256:4bbc40eb232c133e8bfac3e9ad8c165931f54112e6a4d551c7f95e085ab55b32",
|
||||
),
|
||||
(
|
||||
"BASE_SHORT_EDGE",
|
||||
"sha256:383289f43aec04145db7c86df39ccb6565aaf082853fb99f94e3429cd7684556",
|
||||
),
|
||||
(
|
||||
"MAX_PIXELS",
|
||||
"sha256:ff31347e6d92b88b7149ba78d54671ce195da18493b701b5900584aab950956c",
|
||||
),
|
||||
(
|
||||
"REF_IMAGE_SHORT_EDGE",
|
||||
"sha256:a60810bf232af0fd71e3fb9a7bba6bdec75c7beb956760663bbb41bf3102ed10",
|
||||
),
|
||||
(
|
||||
"FPS",
|
||||
"sha256:27b17d774039c50a8b7aef6aaf060822b36c06f89a6b813fce2ada32caaaf0a9",
|
||||
),
|
||||
(
|
||||
"AUDIO_LATENT_FPS",
|
||||
"sha256:ddd3a27d187f8af6911bdaab2b520ec49bae831f1c30d48f923cc0440d2dff98",
|
||||
),
|
||||
(
|
||||
"PH3_IMAGE_SIZE",
|
||||
"sha256:b9a23ae99cb5d5d7b12c4c2ce9047683530e179a4f0d69025608d05895ed1608",
|
||||
),
|
||||
(
|
||||
"PH3_IMAGE_VISION_PIXELS",
|
||||
"sha256:e23b56dcf0280018008026196a2ff610b155e0d2a2e93906418e0de409c62021",
|
||||
),
|
||||
(
|
||||
"PH3_IMAGE_EDIT",
|
||||
"sha256:66b86d5e7389d5979e8f95f62a7f3c0f91832350e668127124dab3aa4a68f649",
|
||||
),
|
||||
),
|
||||
"package_roots": (
|
||||
"comfy",
|
||||
"nodes",
|
||||
"torch",
|
||||
),
|
||||
"required_imports": (
|
||||
"comfy.model_management",
|
||||
"comfy.model_sampling",
|
||||
"comfy.nested_tensor",
|
||||
"nodes",
|
||||
"torch",
|
||||
),
|
||||
"from_bindings": (
|
||||
(
|
||||
"io",
|
||||
"comfy_api.latest",
|
||||
),
|
||||
),
|
||||
"envelope_bindings": (
|
||||
(
|
||||
"ComfyExtension",
|
||||
"comfy_api.latest",
|
||||
),
|
||||
),
|
||||
"protected_builtins": (
|
||||
"classmethod",
|
||||
"hasattr",
|
||||
"max",
|
||||
"round",
|
||||
"staticmethod",
|
||||
),
|
||||
"external_paths": (
|
||||
"comfy.model_management.intermediate_device",
|
||||
"comfy.model_sampling.CONST",
|
||||
"comfy.model_sampling.ModelSamplingAV",
|
||||
"comfy.nested_tensor.NestedTensor",
|
||||
"io.Clip.Input",
|
||||
"io.ComfyNode",
|
||||
"io.Conditioning.Output",
|
||||
"io.Float.Input",
|
||||
"io.Image.Input",
|
||||
"io.Int.Input",
|
||||
"io.Latent.Output",
|
||||
"io.Model.Input",
|
||||
"io.Model.Output",
|
||||
"io.NodeOutput",
|
||||
"io.Schema",
|
||||
"io.String.Input",
|
||||
"io.Vae.Input",
|
||||
"nodes.MAX_RESOLUTION",
|
||||
"torch.zeros",
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
KEYFRAME_DATA: _ManifestData = {
|
||||
"source_revision": "2c75dc1b379a59e0880619d029607af5169a62ef", # pragma: allowlist secret
|
||||
"source_blob": "b0abbc717ba6af7da5169f44467f44364468cda9", # pragma: allowlist secret
|
||||
"definitions": (
|
||||
(
|
||||
"align_frame_count",
|
||||
"sha256:815144140ac0f0c20a42a56f1168ca3086485456a52b4cb552b1d84c362c5cd3",
|
||||
),
|
||||
(
|
||||
"video_latent_t",
|
||||
"sha256:ddbe78607984329c205ec059fbad8114c5055e2a639c64cb7aceeb685316b0af",
|
||||
),
|
||||
(
|
||||
"temporal_shape",
|
||||
"sha256:5632544f143ed19e2cda997c2493292317d42bd117c572a4cb0bdf0e1c60b86f",
|
||||
),
|
||||
(
|
||||
"_resize",
|
||||
"sha256:96f2913538594100cb93e5b1c7bcb0d9b7c3fc9e9c174797c1a40410a4e3eb2f",
|
||||
),
|
||||
(
|
||||
"_encode_ref_audio",
|
||||
"sha256:b26132500b2e30d77567c5a5f39faf3beadbeadcf3e43c6235c8b467c6bdbed0",
|
||||
),
|
||||
(
|
||||
"_av_latent",
|
||||
"sha256:69cca94829c012d7bc5985d7da95a41dda0764e2c307ebe5beda0d422c3554b0",
|
||||
),
|
||||
(
|
||||
"_empty_av_latent",
|
||||
"sha256:6e32805a47da3743c4e10aaeb91de9cd52b7564a328f10765f46fc598e5b9488",
|
||||
),
|
||||
(
|
||||
"EmptyMiniMaxH3LatentAV",
|
||||
"sha256:86eada1c51a9b09e633bb3404517041df858963f8873a914b042883f0005d717",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3SigmaShift",
|
||||
"sha256:6cb500867f47b7a0c6498d5cf564663d079ce1ac60bde13ab3a23b947248cbc6",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3ImageToVideo.define_schema",
|
||||
"sha256:48dbcd4e98c2b9afa141e3087700d870a385f9d901591489efe0b364abbb2857",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3ImageToVideo.execute",
|
||||
"sha256:6f3fd4575f704aec42ae1af1caf9391804aa1918d58ef13e0fe84a08564cb893",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3ImageToVideo",
|
||||
"sha256:1fbe4e8c7fcb3c103ad1b24933b2b0759f7bfdb50df741013a409895db2ac33f",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3AddGuide.define_schema",
|
||||
"sha256:9102fff0ecaea9c0d18683db8736825644d44ec432af0f750b5c27afd62abace",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3AddGuide.execute",
|
||||
"sha256:36eaca7843593620bddc95b837c097ae835ce2be8ed83ea9b80bd8f409c91485",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3AddGuide",
|
||||
"sha256:09c402c1a3f08725eae7ac983b15a4483c1a76fcb356987ee704d29f1303c64b",
|
||||
),
|
||||
),
|
||||
"constants": (
|
||||
(
|
||||
"CANVAS_MULTIPLE",
|
||||
"sha256:4bbc40eb232c133e8bfac3e9ad8c165931f54112e6a4d551c7f95e085ab55b32",
|
||||
),
|
||||
(
|
||||
"BASE_SHORT_EDGE",
|
||||
"sha256:383289f43aec04145db7c86df39ccb6565aaf082853fb99f94e3429cd7684556",
|
||||
),
|
||||
(
|
||||
"MAX_PIXELS",
|
||||
"sha256:ff31347e6d92b88b7149ba78d54671ce195da18493b701b5900584aab950956c",
|
||||
),
|
||||
(
|
||||
"REF_IMAGE_SHORT_EDGE",
|
||||
"sha256:a60810bf232af0fd71e3fb9a7bba6bdec75c7beb956760663bbb41bf3102ed10",
|
||||
),
|
||||
(
|
||||
"FPS",
|
||||
"sha256:27b17d774039c50a8b7aef6aaf060822b36c06f89a6b813fce2ada32caaaf0a9",
|
||||
),
|
||||
(
|
||||
"AUDIO_LATENT_FPS",
|
||||
"sha256:ddd3a27d187f8af6911bdaab2b520ec49bae831f1c30d48f923cc0440d2dff98",
|
||||
),
|
||||
(
|
||||
"PH3_IMAGE_SIZE",
|
||||
"sha256:b9a23ae99cb5d5d7b12c4c2ce9047683530e179a4f0d69025608d05895ed1608",
|
||||
),
|
||||
(
|
||||
"PH3_IMAGE_VISION_PIXELS",
|
||||
"sha256:e23b56dcf0280018008026196a2ff610b155e0d2a2e93906418e0de409c62021",
|
||||
),
|
||||
(
|
||||
"PH3_IMAGE_EDIT",
|
||||
"sha256:66b86d5e7389d5979e8f95f62a7f3c0f91832350e668127124dab3aa4a68f649",
|
||||
),
|
||||
),
|
||||
"package_roots": (
|
||||
"comfy",
|
||||
"math",
|
||||
"node_helpers",
|
||||
"nodes",
|
||||
"torch",
|
||||
),
|
||||
"required_imports": (
|
||||
"comfy.audio",
|
||||
"comfy.model_management",
|
||||
"comfy.model_sampling",
|
||||
"comfy.nested_tensor",
|
||||
"comfy.utils",
|
||||
"math",
|
||||
"node_helpers",
|
||||
"nodes",
|
||||
"torch",
|
||||
),
|
||||
"from_bindings": (
|
||||
(
|
||||
"FRAME_PER_TOKEN",
|
||||
"comfy.ldm.minimax.model",
|
||||
),
|
||||
(
|
||||
"FRAME_RESCALE",
|
||||
"comfy.ldm.minimax.model",
|
||||
),
|
||||
(
|
||||
"io",
|
||||
"comfy_api.latest",
|
||||
),
|
||||
),
|
||||
"envelope_bindings": (
|
||||
(
|
||||
"ComfyExtension",
|
||||
"comfy_api.latest",
|
||||
),
|
||||
),
|
||||
"protected_builtins": (
|
||||
"ValueError",
|
||||
"classmethod",
|
||||
"getattr",
|
||||
"hasattr",
|
||||
"len",
|
||||
"list",
|
||||
"max",
|
||||
"range",
|
||||
"round",
|
||||
"staticmethod",
|
||||
"sum",
|
||||
),
|
||||
"external_paths": (
|
||||
"comfy.audio.resample",
|
||||
"comfy.model_management.intermediate_device",
|
||||
"comfy.model_sampling.CONST",
|
||||
"comfy.model_sampling.ModelSamplingAV",
|
||||
"comfy.nested_tensor.NestedTensor",
|
||||
"comfy.utils.common_upscale",
|
||||
"io.Audio.Input",
|
||||
"io.Clip.Input",
|
||||
"io.ComfyNode",
|
||||
"io.Conditioning.Input",
|
||||
"io.Conditioning.Output",
|
||||
"io.Float.Input",
|
||||
"io.Image.Input",
|
||||
"io.Int.Input",
|
||||
"io.Latent.Input",
|
||||
"io.Latent.Output",
|
||||
"io.Model.Input",
|
||||
"io.Model.Output",
|
||||
"io.NodeOutput",
|
||||
"io.Schema",
|
||||
"io.String.Input",
|
||||
"io.Vae.Input",
|
||||
"math.floor",
|
||||
"node_helpers.conditioning_set_values",
|
||||
"nodes.MAX_RESOLUTION",
|
||||
"torch.zeros",
|
||||
),
|
||||
}
|
||||
@@ -268,8 +268,14 @@ def qualify_native_composition(
|
||||
):
|
||||
# A readable, nonmatching T2VA surface. `check` is a closed manifest identifier.
|
||||
reason, detail = "native_t2va_structure_changed", source.structure.check
|
||||
elif (
|
||||
wiring.task_mode in {TaskMode.I2VA, TaskMode.L2VA, TaskMode.FL2VA}
|
||||
and source.keyframes is not None
|
||||
and not source.keyframes.admitted
|
||||
):
|
||||
reason, detail = "native_keyframe_structure_changed", source.keyframes.check
|
||||
else:
|
||||
# Media modes and bindings stay pinned; a missing receipt is never promoted.
|
||||
# Reference media remain pinned; a missing scoped receipt is never promoted.
|
||||
reason, detail = "native_source_identity_mismatch", "receipt_absent"
|
||||
else:
|
||||
detail = (
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
"""Shared, content-free capability fact for native image guides."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import ast
|
||||
from dataclasses import dataclass
|
||||
|
||||
from .canonical import canonical_fingerprint
|
||||
from .native_t2va_structure import _parse, _Refusal
|
||||
|
||||
GUIDE_NODE_ID = "MiniMaxH3AddGuide"
|
||||
GUIDE_REQUIRED_INPUTS = frozenset({"positive", "vae", "latent", "image", "frame_idx"})
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class NativeGuideCapability:
|
||||
registered: bool
|
||||
input_names: frozenset[str]
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
if (
|
||||
type(self.registered) is not bool
|
||||
or type(self.input_names) is not frozenset
|
||||
or len(self.input_names) > 64
|
||||
or any(type(name) is not str or not 1 <= len(name) <= 128 for name in self.input_names)
|
||||
):
|
||||
raise ValueError("invalid_native_guide_capability")
|
||||
|
||||
@property
|
||||
def admitted(self) -> bool:
|
||||
return self.registered and GUIDE_REQUIRED_INPUTS <= self.input_names
|
||||
|
||||
@property
|
||||
def fingerprint(self) -> str:
|
||||
return canonical_fingerprint(
|
||||
{
|
||||
"schema": "h3.native_image_guide_capability.v1",
|
||||
"registered": self.registered,
|
||||
"inputs": sorted(self.input_names),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def observe_guide_capability(content: bytes, *, registered: bool) -> NativeGuideCapability:
|
||||
"""Read literal schema names from the same bounded buffer, without invoking host code.
|
||||
|
||||
This fact is necessary but insufficient: a keyframe structural verdict separately proves
|
||||
the entire schema/index/conditioning definition. An input-name match grants no execution.
|
||||
"""
|
||||
try:
|
||||
tree = _parse(content)
|
||||
except (_Refusal, RecursionError):
|
||||
return NativeGuideCapability(False, frozenset())
|
||||
owners = [
|
||||
node for node in tree.body if isinstance(node, ast.ClassDef) and node.name == GUIDE_NODE_ID
|
||||
]
|
||||
if len(owners) != 1:
|
||||
return NativeGuideCapability(False, frozenset())
|
||||
methods = [
|
||||
node
|
||||
for node in owners[0].body
|
||||
if isinstance(node, ast.FunctionDef) and node.name == "define_schema"
|
||||
]
|
||||
if len(methods) != 1:
|
||||
return NativeGuideCapability(False, frozenset())
|
||||
schemas = [
|
||||
node
|
||||
for node in ast.walk(methods[0])
|
||||
if isinstance(node, ast.Call)
|
||||
and isinstance(node.func, ast.Attribute)
|
||||
and node.func.attr == "Schema"
|
||||
and isinstance(node.func.value, ast.Name)
|
||||
and node.func.value.id == "io"
|
||||
]
|
||||
if len(schemas) != 1:
|
||||
return NativeGuideCapability(False, frozenset())
|
||||
inputs = [kw.value for kw in schemas[0].keywords if kw.arg == "inputs"]
|
||||
if len(inputs) != 1 or not isinstance(inputs[0], ast.List) or len(inputs[0].elts) > 64:
|
||||
return NativeGuideCapability(False, frozenset())
|
||||
names = []
|
||||
for item in inputs[0].elts:
|
||||
if (
|
||||
not isinstance(item, ast.Call)
|
||||
or not isinstance(item.func, ast.Attribute)
|
||||
or item.func.attr != "Input"
|
||||
or not item.args
|
||||
or not isinstance(item.args[0], ast.Constant)
|
||||
or type(item.args[0].value) is not str
|
||||
or not 1 <= len(item.args[0].value) <= 128
|
||||
):
|
||||
return NativeGuideCapability(False, frozenset())
|
||||
names.append(item.args[0].value)
|
||||
if len(names) != len(set(names)):
|
||||
return NativeGuideCapability(False, frozenset())
|
||||
return NativeGuideCapability(registered, frozenset(names))
|
||||
@@ -0,0 +1,166 @@
|
||||
"""Audited native keyframe/image-guide AST digests and closed dependency surface.
|
||||
|
||||
Provenance identifies the audited input only; runtime admission never compares it.
|
||||
The complete AddGuide definition is conserved; this does not enable audio execution.
|
||||
"""
|
||||
|
||||
from typing import TypedDict
|
||||
|
||||
|
||||
class _ManifestData(TypedDict):
|
||||
source_revision: str
|
||||
source_blob: str
|
||||
definitions: tuple[tuple[str, str], ...]
|
||||
constants: tuple[tuple[str, str], ...]
|
||||
package_roots: tuple[str, ...]
|
||||
required_imports: tuple[str, ...]
|
||||
from_bindings: tuple[tuple[str, str], ...]
|
||||
envelope_bindings: tuple[tuple[str, str], ...]
|
||||
protected_builtins: tuple[str, ...]
|
||||
external_paths: tuple[str, ...]
|
||||
|
||||
|
||||
MANIFEST_DATA: _ManifestData = {
|
||||
"source_revision": "fe298e4e20f1ff26d30e8639267bbd0b57811390", # pragma: allowlist secret
|
||||
"source_blob": "1ad3c6a4095fdcb756d6222f08ba589452b72091", # pragma: allowlist secret
|
||||
"definitions": (
|
||||
(
|
||||
"align_frame_count",
|
||||
"sha256:815144140ac0f0c20a42a56f1168ca3086485456a52b4cb552b1d84c362c5cd3",
|
||||
),
|
||||
(
|
||||
"video_latent_t",
|
||||
"sha256:ddbe78607984329c205ec059fbad8114c5055e2a639c64cb7aceeb685316b0af",
|
||||
),
|
||||
(
|
||||
"temporal_shape",
|
||||
"sha256:5632544f143ed19e2cda997c2493292317d42bd117c572a4cb0bdf0e1c60b86f",
|
||||
),
|
||||
("_resize", "sha256:96f2913538594100cb93e5b1c7bcb0d9b7c3fc9e9c174797c1a40410a4e3eb2f"),
|
||||
(
|
||||
"_encode_ref_audio",
|
||||
"sha256:b26132500b2e30d77567c5a5f39faf3beadbeadcf3e43c6235c8b467c6bdbed0",
|
||||
),
|
||||
(
|
||||
"_empty_av_latent",
|
||||
"sha256:26fadedcd7bbed2d72094e8bb20ec2f4b4f3b125dad8eeba57f14092a6e3351d",
|
||||
),
|
||||
(
|
||||
"EmptyMiniMaxH3LatentAV",
|
||||
"sha256:86eada1c51a9b09e633bb3404517041df858963f8873a914b042883f0005d717",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3SigmaShift",
|
||||
"sha256:6cb500867f47b7a0c6498d5cf564663d079ce1ac60bde13ab3a23b947248cbc6",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3ImageToVideo.define_schema",
|
||||
"sha256:48dbcd4e98c2b9afa141e3087700d870a385f9d901591489efe0b364abbb2857",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3ImageToVideo.execute",
|
||||
"sha256:6f3fd4575f704aec42ae1af1caf9391804aa1918d58ef13e0fe84a08564cb893",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3ImageToVideo",
|
||||
"sha256:1fbe4e8c7fcb3c103ad1b24933b2b0759f7bfdb50df741013a409895db2ac33f",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3AddGuide.define_schema",
|
||||
"sha256:9102fff0ecaea9c0d18683db8736825644d44ec432af0f750b5c27afd62abace",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3AddGuide.execute",
|
||||
"sha256:36eaca7843593620bddc95b837c097ae835ce2be8ed83ea9b80bd8f409c91485",
|
||||
),
|
||||
(
|
||||
"MiniMaxH3AddGuide",
|
||||
"sha256:09c402c1a3f08725eae7ac983b15a4483c1a76fcb356987ee704d29f1303c64b",
|
||||
),
|
||||
), # pragma: allowlist secret
|
||||
"constants": (
|
||||
(
|
||||
"CANVAS_MULTIPLE",
|
||||
"sha256:4bbc40eb232c133e8bfac3e9ad8c165931f54112e6a4d551c7f95e085ab55b32",
|
||||
),
|
||||
(
|
||||
"BASE_SHORT_EDGE",
|
||||
"sha256:383289f43aec04145db7c86df39ccb6565aaf082853fb99f94e3429cd7684556",
|
||||
),
|
||||
("MAX_PIXELS", "sha256:ff31347e6d92b88b7149ba78d54671ce195da18493b701b5900584aab950956c"),
|
||||
(
|
||||
"REF_IMAGE_SHORT_EDGE",
|
||||
"sha256:a60810bf232af0fd71e3fb9a7bba6bdec75c7beb956760663bbb41bf3102ed10",
|
||||
),
|
||||
("FPS", "sha256:27b17d774039c50a8b7aef6aaf060822b36c06f89a6b813fce2ada32caaaf0a9"),
|
||||
(
|
||||
"AUDIO_LATENT_FPS",
|
||||
"sha256:ddd3a27d187f8af6911bdaab2b520ec49bae831f1c30d48f923cc0440d2dff98",
|
||||
),
|
||||
), # pragma: allowlist secret
|
||||
"package_roots": (
|
||||
"comfy",
|
||||
"math",
|
||||
"node_helpers",
|
||||
"nodes",
|
||||
"torch",
|
||||
), # pragma: allowlist secret
|
||||
"required_imports": (
|
||||
"comfy.audio",
|
||||
"comfy.model_management",
|
||||
"comfy.model_sampling",
|
||||
"comfy.nested_tensor",
|
||||
"comfy.utils",
|
||||
"math",
|
||||
"node_helpers",
|
||||
"nodes",
|
||||
"torch",
|
||||
), # pragma: allowlist secret
|
||||
"from_bindings": (
|
||||
("FRAME_PER_TOKEN", "comfy.ldm.minimax.model"),
|
||||
("FRAME_RESCALE", "comfy.ldm.minimax.model"),
|
||||
("io", "comfy_api.latest"),
|
||||
), # pragma: allowlist secret
|
||||
"envelope_bindings": (("ComfyExtension", "comfy_api.latest"),), # pragma: allowlist secret
|
||||
"protected_builtins": (
|
||||
"ValueError",
|
||||
"classmethod",
|
||||
"getattr",
|
||||
"hasattr",
|
||||
"len",
|
||||
"list",
|
||||
"max",
|
||||
"range",
|
||||
"round",
|
||||
"staticmethod",
|
||||
"sum",
|
||||
), # pragma: allowlist secret
|
||||
"external_paths": (
|
||||
"comfy.audio.resample",
|
||||
"comfy.model_management.intermediate_device",
|
||||
"comfy.model_sampling.CONST",
|
||||
"comfy.model_sampling.ModelSamplingAV",
|
||||
"comfy.nested_tensor.NestedTensor",
|
||||
"comfy.utils.common_upscale",
|
||||
"io.Audio.Input",
|
||||
"io.Clip.Input",
|
||||
"io.ComfyNode",
|
||||
"io.Conditioning.Input",
|
||||
"io.Conditioning.Output",
|
||||
"io.Float.Input",
|
||||
"io.Image.Input",
|
||||
"io.Int.Input",
|
||||
"io.Latent.Input",
|
||||
"io.Latent.Output",
|
||||
"io.Model.Input",
|
||||
"io.Model.Output",
|
||||
"io.NodeOutput",
|
||||
"io.Schema",
|
||||
"io.String.Input",
|
||||
"io.Vae.Input",
|
||||
"math.floor",
|
||||
"node_helpers.conditioning_set_values",
|
||||
"nodes.MAX_RESOLUTION",
|
||||
"torch.zeros",
|
||||
), # pragma: allowlist secret
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
"""Parse-only admission of unmasked native keyframes and explicit image guides.
|
||||
|
||||
The manifest proves the selected definitions and their definition-time dependency closure.
|
||||
It does not compare a loaded source's version, revision or blob. Imported libraries and runtime
|
||||
monkeypatches are outside this static proof; registered objects remain receipt currentness facts.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import asdict, dataclass
|
||||
from enum import Enum
|
||||
|
||||
from . import native_baseline_v0_44 as lineage_v0_44
|
||||
from . import native_t2va_structure as structure
|
||||
from .native_keyframe_baseline import MANIFEST_DATA
|
||||
|
||||
NATIVE_KEYFRAME_CLASSIFIER_SCHEMA = "h3.native_keyframe_structure.v1"
|
||||
NATIVE_KEYFRAME_MANIFEST_SCHEMA = "h3.native_keyframe_baseline_manifest.v1"
|
||||
|
||||
|
||||
class KeyframeStructureReason(str, Enum):
|
||||
ADMITTED = "native_keyframe_structure_admitted"
|
||||
CHANGED = "native_keyframe_structure_changed"
|
||||
UNPARSABLE = "native_keyframe_structure_unparsable"
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class NativeKeyframeBaselineManifest(structure.NativeT2VABaselineManifest):
|
||||
def to_wire(self) -> dict[str, object]:
|
||||
# Explicit base call also works with slots dataclasses on supported Python versions.
|
||||
wire = structure.NativeT2VABaselineManifest.to_wire(self)
|
||||
return {
|
||||
**wire,
|
||||
"schema": NATIVE_KEYFRAME_MANIFEST_SCHEMA,
|
||||
"classifier_schema": NATIVE_KEYFRAME_CLASSIFIER_SCHEMA,
|
||||
}
|
||||
|
||||
|
||||
PRODUCTION_MANIFEST = NativeKeyframeBaselineManifest(**MANIFEST_DATA)
|
||||
# The audited production lineages, oldest first. The first is the original baseline and never
|
||||
# changes; a lineage is added only by deriving it from audited upstream bytes. Admission is
|
||||
# membership of a verdict's manifest fingerprint in this closed set, never a caller's table.
|
||||
PRODUCTION_LINEAGES: tuple[NativeKeyframeBaselineManifest, ...] = (
|
||||
PRODUCTION_MANIFEST,
|
||||
NativeKeyframeBaselineManifest(**lineage_v0_44.KEYFRAME_DATA),
|
||||
)
|
||||
PRODUCTION_FINGERPRINTS: frozenset[str] = frozenset(
|
||||
item.fingerprint for item in PRODUCTION_LINEAGES
|
||||
)
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class NativeKeyframeStructureVerdict:
|
||||
reason: KeyframeStructureReason
|
||||
check: str
|
||||
manifest_fingerprint: str
|
||||
classifier_schema: str = NATIVE_KEYFRAME_CLASSIFIER_SCHEMA
|
||||
|
||||
@property
|
||||
def admitted(self) -> bool:
|
||||
return self.reason is KeyframeStructureReason.ADMITTED
|
||||
|
||||
|
||||
def _classify(
|
||||
content: bytes, manifest: NativeKeyframeBaselineManifest
|
||||
) -> NativeKeyframeStructureVerdict:
|
||||
try:
|
||||
envelope = structure._check_envelope(structure._parse(content), manifest)
|
||||
expected = dict(manifest.definitions) | dict(manifest.constants)
|
||||
# CRITICAL: frame callers execute the bodies masked by binding-free T2VA admission.
|
||||
# Never reuse its masked surface: that would admit changed frame indices/conditioning.
|
||||
for name, node in structure._surface_nodes(
|
||||
envelope.definitions, (name for name, _ in manifest.definitions), mask_keyframes=False
|
||||
):
|
||||
if structure.definition_digest(node) != expected[name]:
|
||||
raise structure._changed("definition:" + name)
|
||||
for name, _ in manifest.constants:
|
||||
constant_node = envelope.constants.get(name)
|
||||
if (
|
||||
constant_node is None
|
||||
or structure.definition_digest(constant_node) != expected[name]
|
||||
):
|
||||
raise structure._changed("constant:" + name)
|
||||
except structure._Refusal as refusal:
|
||||
reason = (
|
||||
KeyframeStructureReason.UNPARSABLE
|
||||
if refusal.reason is structure.StructureReason.UNPARSABLE
|
||||
else KeyframeStructureReason.CHANGED
|
||||
)
|
||||
return NativeKeyframeStructureVerdict(reason, refusal.check, manifest.fingerprint)
|
||||
except RecursionError:
|
||||
return NativeKeyframeStructureVerdict(
|
||||
KeyframeStructureReason.UNPARSABLE, "source_depth_limit", manifest.fingerprint
|
||||
)
|
||||
return NativeKeyframeStructureVerdict(
|
||||
KeyframeStructureReason.ADMITTED, "admitted", manifest.fingerprint
|
||||
)
|
||||
|
||||
|
||||
def classify_native_keyframe_source(content: bytes) -> NativeKeyframeStructureVerdict:
|
||||
return structure.classify_lineages(content, PRODUCTION_LINEAGES, _classify)
|
||||
|
||||
|
||||
def is_production_admission(value: object) -> bool:
|
||||
# CRITICAL: membership in the closed fingerprint set is the whole test; see the T2VA scope.
|
||||
return (
|
||||
type(value) is NativeKeyframeStructureVerdict
|
||||
and value.admitted
|
||||
and value.classifier_schema == NATIVE_KEYFRAME_CLASSIFIER_SCHEMA
|
||||
and value.manifest_fingerprint in PRODUCTION_FINGERPRINTS
|
||||
)
|
||||
|
||||
|
||||
def derive_keyframe_manifest(
|
||||
content: bytes, *, source_revision: str, source_blob: str, definitions: tuple[str, ...]
|
||||
) -> NativeKeyframeBaselineManifest:
|
||||
"""Maintainer/test derivation only; production admission accepts no external table."""
|
||||
raw = structure.derive_manifest(
|
||||
content,
|
||||
source_revision=source_revision,
|
||||
source_blob=source_blob,
|
||||
definitions=definitions,
|
||||
mask_keyframes=False,
|
||||
)
|
||||
return NativeKeyframeBaselineManifest(**asdict(raw))
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Structural compatibility of the loaded native source for binding-free T2VA only.
|
||||
"""Scoped structural compatibility of the loaded native source.
|
||||
|
||||
The admission is computed from the loaded bytes at qualification time (`native_t2va_structure`),
|
||||
never from a host version, revision or blob allowlist. The raw blob stays a currentness identity:
|
||||
@@ -8,10 +8,18 @@ any byte change invalidates an issued receipt, and only a fresh observation may
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import cast
|
||||
|
||||
from .canonical import canonical_fingerprint
|
||||
from .contracts import TaskMode
|
||||
from .contracts import MediaKind, TaskMode
|
||||
from .native_guide import NativeGuideCapability
|
||||
from .native_h3 import NATIVE_H3_HOST_REVISION, NATIVE_H3_SOURCE_BLOB, NativeH3Wiring
|
||||
from .native_keyframe_structure import (
|
||||
NativeKeyframeStructureVerdict,
|
||||
)
|
||||
from .native_keyframe_structure import (
|
||||
is_production_admission as is_keyframe_admission,
|
||||
)
|
||||
from .native_t2va_structure import (
|
||||
PRODUCTION_MANIFEST,
|
||||
NativeT2VAStructureVerdict,
|
||||
@@ -31,6 +39,8 @@ class NativeSourceObservation:
|
||||
source_blob: str
|
||||
structure: NativeT2VAStructureVerdict
|
||||
_origin: tuple[object, ...] = field(repr=False)
|
||||
keyframes: NativeKeyframeStructureVerdict | None = None
|
||||
guide: NativeGuideCapability | None = None
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
@@ -38,35 +48,65 @@ class NativeSourceCompatibilityV2:
|
||||
"""A receipt bound to the ORIGINAL observation it was minted from, never re-minted."""
|
||||
|
||||
_source: NativeSourceObservation = field(repr=False)
|
||||
scope: str = "structural_t2va_without_bindings"
|
||||
|
||||
def admits(self, source: NativeSourceObservation | None, wiring: NativeH3Wiring) -> bool:
|
||||
# CRITICAL: only the binding-free T2VA branch is structurally proven. Media branches
|
||||
# changed conditioning between revisions; they must never borrow this receipt.
|
||||
return (
|
||||
# CRITICAL: compare the ORIGINAL observation and its own audited scope. A T2VA
|
||||
# verdict masks media bodies and must never grant keyframe or reference execution.
|
||||
current = (
|
||||
type(self) is NativeSourceCompatibilityV2
|
||||
and type(source) is NativeSourceObservation
|
||||
and type(self._source) is NativeSourceObservation
|
||||
and source == self._source
|
||||
and source.source_blob != NATIVE_H3_SOURCE_BLOB
|
||||
and is_production_admission(source.structure)
|
||||
and wiring.task_mode is TaskMode.T2VA
|
||||
and not wiring.bindings
|
||||
and wiring.native_source_blob == NATIVE_H3_SOURCE_BLOB
|
||||
and wiring.host_revision == NATIVE_H3_HOST_REVISION
|
||||
)
|
||||
if not current:
|
||||
return False
|
||||
source = cast(NativeSourceObservation, source)
|
||||
if self.scope == "structural_t2va_without_bindings":
|
||||
return (
|
||||
is_production_admission(source.structure)
|
||||
and wiring.task_mode is TaskMode.T2VA
|
||||
and not wiring.bindings
|
||||
)
|
||||
expected = {
|
||||
TaskMode.I2VA: frozenset({"first_frame"}),
|
||||
TaskMode.L2VA: frozenset({"last_frame"}),
|
||||
TaskMode.FL2VA: frozenset({"first_frame", "last_frame"}),
|
||||
}.get(wiring.task_mode)
|
||||
return (
|
||||
self.scope == "structural_keyframe"
|
||||
and expected is not None
|
||||
and len(wiring.bindings) == len(expected)
|
||||
and frozenset(row.native_input for row in wiring.bindings) == expected
|
||||
and all(row.kind is MediaKind.IMAGE for row in wiring.bindings)
|
||||
and is_keyframe_admission(source.keyframes)
|
||||
and type(source.guide) is NativeGuideCapability
|
||||
and source.guide.admitted
|
||||
)
|
||||
|
||||
@property
|
||||
def fingerprint(self) -> str:
|
||||
return canonical_fingerprint(
|
||||
{
|
||||
"schema": "h3.native_source_compatibility.v2",
|
||||
"classifier_schema": self._source.structure.classifier_schema,
|
||||
"manifest_fingerprint": self._source.structure.manifest_fingerprint,
|
||||
"source_blob": self._source.source_blob,
|
||||
"baseline_blob": NATIVE_H3_SOURCE_BLOB,
|
||||
"scope": "structural_t2va_without_bindings",
|
||||
}
|
||||
verdict = (
|
||||
cast(NativeKeyframeStructureVerdict, self._source.keyframes)
|
||||
if self.scope == "structural_keyframe"
|
||||
else self._source.structure
|
||||
)
|
||||
wire = {
|
||||
"schema": "h3.native_source_compatibility.v2",
|
||||
"classifier_schema": verdict.classifier_schema,
|
||||
"manifest_fingerprint": verdict.manifest_fingerprint,
|
||||
"source_blob": self._source.source_blob,
|
||||
"baseline_blob": NATIVE_H3_SOURCE_BLOB,
|
||||
"scope": self.scope,
|
||||
}
|
||||
if self.scope == "structural_keyframe":
|
||||
wire["guide_capability_fingerprint"] = cast(
|
||||
NativeGuideCapability, self._source.guide
|
||||
).fingerprint
|
||||
return canonical_fingerprint(wire)
|
||||
|
||||
|
||||
def qualify_native_source_compatibility(
|
||||
@@ -75,7 +115,12 @@ def qualify_native_source_compatibility(
|
||||
"""Mint a receipt for a structurally admitted non-baseline source; the baseline needs none."""
|
||||
if type(source) is not NativeSourceObservation or source.source_blob == NATIVE_H3_SOURCE_BLOB:
|
||||
return None
|
||||
receipt = NativeSourceCompatibilityV2(source)
|
||||
scope = (
|
||||
"structural_keyframe"
|
||||
if wiring.task_mode in {TaskMode.I2VA, TaskMode.L2VA, TaskMode.FL2VA}
|
||||
else "structural_t2va_without_bindings"
|
||||
)
|
||||
receipt = NativeSourceCompatibilityV2(source, scope)
|
||||
return receipt if receipt.admits(source, wiring) else None
|
||||
|
||||
|
||||
|
||||
@@ -20,10 +20,12 @@ import io
|
||||
import json
|
||||
import symtable
|
||||
import tokenize
|
||||
from collections.abc import Iterator, Sequence
|
||||
from collections.abc import Callable, Iterator, Sequence
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
from typing import Protocol, TypeVar
|
||||
|
||||
from . import native_baseline_v0_44 as lineage_v0_44
|
||||
from . import native_t2va_baseline as baseline
|
||||
|
||||
NATIVE_T2VA_CLASSIFIER_SCHEMA = "h3.native_t2va_structure.v1"
|
||||
@@ -48,6 +50,11 @@ _ENVELOPE_DECORATORS = frozenset({"classmethod", "staticmethod"})
|
||||
_CLASS_CREATION_HOOKS = frozenset(
|
||||
{"__init_subclass__", "__set_name__", "__class_getitem__", "__mro_entries__", "__prepare__"}
|
||||
)
|
||||
# The one module-level call form the envelope admits besides literals, as (module, attribute)
|
||||
# pairs, and only while that module is bound by its own plain `import`. Closed on purpose: a pair
|
||||
# joins this tuple only together with refusal rows for its arguments and a mutation receipt, never
|
||||
# to make one more host source pass. Anything else called at module level stays `envelope_assign`.
|
||||
_CLOSED_CALLS = (("re", "compile"),)
|
||||
_COMFY_NODE_BASE = ("io", "ComfyNode")
|
||||
_EXTENSION_BASE = "ComfyExtension"
|
||||
_LITERAL_BINARY_OPERATORS = (
|
||||
@@ -178,6 +185,21 @@ def _json_bytes(value: object) -> bytes:
|
||||
return json.dumps(value, ensure_ascii=True, separators=(",", ":")).encode("ascii")
|
||||
|
||||
|
||||
# The audited production lineages, oldest first: one per audited shape of the native source. The
|
||||
# first lineage is the original baseline and never changes, so every fingerprint minted against it
|
||||
# stays valid. A lineage is added only by deriving it from audited upstream bytes, never from a
|
||||
# caller-supplied table or an observed source. (Defined here, not beside the manifest: a
|
||||
# fingerprint needs `_json_bytes`.) The second is the shape whose empty-latent helper is split in
|
||||
# two, derived with `scripts/native_t2va_structure.py --shape split-latent --emit-lineage`.
|
||||
PRODUCTION_LINEAGES: tuple[NativeT2VABaselineManifest, ...] = (
|
||||
PRODUCTION_MANIFEST,
|
||||
NativeT2VABaselineManifest(**lineage_v0_44.T2VA_DATA),
|
||||
)
|
||||
PRODUCTION_FINGERPRINTS: frozenset[str] = frozenset(
|
||||
item.fingerprint for item in PRODUCTION_LINEAGES
|
||||
)
|
||||
|
||||
|
||||
# --- parsing and bounds -------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -287,6 +309,56 @@ def _is_literal(node: ast.AST) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def _is_regex_flags(node: ast.AST, module: str) -> bool:
|
||||
# An int literal (never a bool) or uppercase attributes of the bound module joined with `|`.
|
||||
if isinstance(node, ast.Constant):
|
||||
return type(node.value) is int
|
||||
if isinstance(node, ast.BinOp):
|
||||
return (
|
||||
isinstance(node.op, ast.BitOr)
|
||||
and _is_regex_flags(node.left, module)
|
||||
and _is_regex_flags(node.right, module)
|
||||
)
|
||||
return (
|
||||
isinstance(node, ast.Attribute)
|
||||
and isinstance(node.value, ast.Name)
|
||||
and node.value.id == module
|
||||
and node.attr.isascii()
|
||||
and node.attr.isidentifier()
|
||||
and node.attr.isupper()
|
||||
)
|
||||
|
||||
|
||||
def _is_closed_call(node: ast.AST, plain_imports: frozenset[str]) -> bool:
|
||||
"""A pinned module-level call: `re.compile(<str literal>[, <flags>])`, nothing else.
|
||||
|
||||
CRITICAL: this is the only call the definition-time envelope admits, because every other call
|
||||
could run host code or rebind a protected name when the module loads. Keep each guard: the pair
|
||||
must be in the closed tuple, the module must be bound by a plain `import` (an alias, a dotted
|
||||
import or `from re import compile` would let the name mean something else), the call takes
|
||||
positional arguments only, the pattern is a plain `str` literal (a name, a call, an f-string,
|
||||
bytes or a concatenation can run code), and the flags are the pinned shape above. Admitting any
|
||||
other `re` attribute, a keyword, or a wider expression reopens the module-level effect hole.
|
||||
"""
|
||||
if not (
|
||||
isinstance(node, ast.Call)
|
||||
and isinstance(node.func, ast.Attribute)
|
||||
and isinstance(node.func.value, ast.Name)
|
||||
):
|
||||
return False
|
||||
module = node.func.value.id
|
||||
if (module, node.func.attr) not in _CLOSED_CALLS or module not in plain_imports:
|
||||
return False
|
||||
if node.keywords or not 1 <= len(node.args) <= 2:
|
||||
return False
|
||||
pattern, *flags = node.args
|
||||
return (
|
||||
isinstance(pattern, ast.Constant)
|
||||
and type(pattern.value) is str
|
||||
and all(_is_regex_flags(item, module) for item in flags)
|
||||
)
|
||||
|
||||
|
||||
def _is_reference(node: ast.AST) -> bool:
|
||||
# A non-call annotation: a string, a name or a dotted attribute chain rooted at a name.
|
||||
if isinstance(node, ast.Constant):
|
||||
@@ -430,7 +502,13 @@ def _check_envelope(tree: ast.Module, manifest: NativeT2VABaselineManifest) -> _
|
||||
if len(statement.targets) != 1 or not isinstance(statement.targets[0], ast.Name):
|
||||
raise _changed("envelope_assign")
|
||||
name = statement.targets[0].id
|
||||
if not _is_literal(statement.value):
|
||||
# `envelope.imports` holds exactly the names a plain `import` has bound so far, and
|
||||
# `bind` refuses any later rebinding of them, so the closed form cannot be redirected
|
||||
# by a statement that follows it (a rebinding before it is refused the same way).
|
||||
if not (
|
||||
_is_literal(statement.value)
|
||||
or _is_closed_call(statement.value, frozenset(envelope.imports))
|
||||
):
|
||||
raise _changed("envelope_assign")
|
||||
if name in protected and name not in constants:
|
||||
raise _changed("binding:" + name)
|
||||
@@ -574,6 +652,8 @@ def _member(node: ast.AST, name: str, member: str) -> ast.AST:
|
||||
def _surface_nodes(
|
||||
definitions: dict[str, ast.FunctionDef | ast.AsyncFunctionDef | ast.ClassDef],
|
||||
names: Iterator[str],
|
||||
*,
|
||||
mask_keyframes: bool = True,
|
||||
) -> Iterator[tuple[str, ast.AST]]:
|
||||
masked: dict[str, ast.AST] = {}
|
||||
for name in names:
|
||||
@@ -581,7 +661,7 @@ def _surface_nodes(
|
||||
node: ast.AST | None = definitions.get(owner)
|
||||
if node is None:
|
||||
raise _changed("definition:" + owner)
|
||||
if owner == IMAGE_TO_VIDEO:
|
||||
if owner == IMAGE_TO_VIDEO and mask_keyframes:
|
||||
if owner not in masked:
|
||||
masked[owner] = _masked_image_to_video(node)
|
||||
node = masked[owner]
|
||||
@@ -619,18 +699,54 @@ def _classify(content: bytes, manifest: NativeT2VABaselineManifest) -> NativeT2V
|
||||
return NativeT2VAStructureVerdict(StructureReason.ADMITTED, "admitted", manifest.fingerprint)
|
||||
|
||||
|
||||
class _Admitting(Protocol):
|
||||
@property
|
||||
def admitted(self) -> bool: ...
|
||||
|
||||
|
||||
_Manifest = TypeVar("_Manifest")
|
||||
_Verdict = TypeVar("_Verdict", bound=_Admitting)
|
||||
|
||||
|
||||
def classify_lineages(
|
||||
content: bytes,
|
||||
manifests: Sequence[_Manifest],
|
||||
classify: Callable[[bytes, _Manifest], _Verdict],
|
||||
) -> _Verdict:
|
||||
"""Try the lineages in order and return the first admitted verdict.
|
||||
|
||||
When none admits, the verdict of the last (newest) lineage is returned: its refusal names the
|
||||
check a source of the newest shape fails, which is the most useful one to report. Every
|
||||
verdict carries the fingerprint of the manifest that produced it.
|
||||
"""
|
||||
verdict: _Verdict | None = None
|
||||
for manifest in manifests:
|
||||
verdict = classify(content, manifest)
|
||||
if verdict.admitted:
|
||||
return verdict
|
||||
if verdict is None:
|
||||
raise ValueError("no lineage to classify against")
|
||||
return verdict
|
||||
|
||||
|
||||
def classify_native_t2va_source(content: bytes) -> NativeT2VAStructureVerdict:
|
||||
"""Classify loaded native bytes against the production baseline; no table is accepted."""
|
||||
return _classify(content, PRODUCTION_MANIFEST)
|
||||
"""Classify loaded native bytes against the production lineages; no table is accepted."""
|
||||
return classify_lineages(content, PRODUCTION_LINEAGES, _classify)
|
||||
|
||||
|
||||
def is_production_admission(verdict: object) -> bool:
|
||||
"""True only for an admitted verdict produced against the current production manifest."""
|
||||
"""True only for an admitted verdict produced against one of the production lineages.
|
||||
|
||||
CRITICAL: membership in the closed fingerprint set is the whole test. Never accept a caller's
|
||||
manifest, table or fingerprint here, and never loosen it to a schema or reason check: a
|
||||
synthetic manifest classifies sources too, and only this set separates its verdicts from
|
||||
production authority.
|
||||
"""
|
||||
return (
|
||||
type(verdict) is NativeT2VAStructureVerdict
|
||||
and verdict.admitted
|
||||
and verdict.classifier_schema == NATIVE_T2VA_CLASSIFIER_SCHEMA
|
||||
and verdict.manifest_fingerprint == PRODUCTION_MANIFEST.fingerprint
|
||||
and verdict.manifest_fingerprint in PRODUCTION_FINGERPRINTS
|
||||
)
|
||||
|
||||
|
||||
@@ -669,6 +785,7 @@ def derive_manifest(
|
||||
source_revision: str,
|
||||
source_blob: str,
|
||||
definitions: tuple[str, ...],
|
||||
mask_keyframes: bool = True,
|
||||
) -> NativeT2VABaselineManifest:
|
||||
"""Derive a manifest from an accepted source; refuses a surface whose closure is open."""
|
||||
tree = _parse(content)
|
||||
@@ -686,7 +803,7 @@ def derive_manifest(
|
||||
]
|
||||
imports = [node for node in tree.body if isinstance(node, (ast.Import, ast.ImportFrom))]
|
||||
try:
|
||||
rows = list(_surface_nodes(top, iter(definitions)))
|
||||
rows = list(_surface_nodes(top, iter(definitions), mask_keyframes=mask_keyframes))
|
||||
except _Refusal:
|
||||
raise ValueError("definition absent or differently shaped") from None
|
||||
# The closure is computed over top-level definitions; member rows are contained in them.
|
||||
@@ -696,6 +813,22 @@ def derive_manifest(
|
||||
if {name.split(".", 1)[0] for name in definitions} != {name for name, _node in surface}:
|
||||
raise ValueError("a member row needs its top-level definition row")
|
||||
referenced = _referenced_globals([node for _name, node in surface], imports)
|
||||
plain_imports = frozenset(
|
||||
alias.name
|
||||
for node in imports
|
||||
if isinstance(node, ast.Import)
|
||||
for alias in node.names
|
||||
if alias.asname is None
|
||||
)
|
||||
# An unread compiled regular expression is outside the audited surface: pinning it would turn
|
||||
# an upstream edit of an unrelated pattern into a refusal of the whole lineage. A literal
|
||||
# constant keeps its existing behavior (every literal is pinned, read or not).
|
||||
constant_nodes = [
|
||||
node
|
||||
for node in constant_nodes
|
||||
if not _is_closed_call(node.value, plain_imports)
|
||||
or any(isinstance(target, ast.Name) and target.id in referenced for target in node.targets)
|
||||
]
|
||||
constant_names = {
|
||||
target.id
|
||||
for node in constant_nodes
|
||||
@@ -766,10 +899,13 @@ __all__ = [
|
||||
"MAX_AST_DEPTH",
|
||||
"MAX_AST_NODES",
|
||||
"MAX_SOURCE_BYTES",
|
||||
"PRODUCTION_FINGERPRINTS",
|
||||
"PRODUCTION_LINEAGES",
|
||||
"PRODUCTION_MANIFEST",
|
||||
"NativeT2VABaselineManifest",
|
||||
"NativeT2VAStructureVerdict",
|
||||
"StructureReason",
|
||||
"classify_lineages",
|
||||
"classify_native_t2va_source",
|
||||
"definition_digest",
|
||||
"derive_manifest",
|
||||
|
||||
@@ -1271,6 +1271,11 @@ def slice_production_semantics(
|
||||
raise ProductionSemanticError("semantic_slice_interval")
|
||||
target_assets = _ids(asset_ids, "semantic_slice_asset_ids")
|
||||
target_asset_set = set(target_assets)
|
||||
frame_assets = {
|
||||
item.asset_id
|
||||
for item in authority.reference_definitions
|
||||
if item.role in {AssetRole.FIRST_FRAME, AssetRole.LAST_FRAME}
|
||||
}
|
||||
subject_source_assets = {
|
||||
item.subject_id: frozenset(item.source_asset_ids) for item in authority.subject_definitions
|
||||
}
|
||||
@@ -1301,8 +1306,20 @@ def slice_production_semantics(
|
||||
)
|
||||
local_globals: list[SemanticFieldV1] = []
|
||||
for item in authority.global_fields:
|
||||
if required_assets(item.subject_ids, item.asset_ids).issubset(target_asset_set):
|
||||
local_globals.append(item)
|
||||
# CRITICAL: a direct frame binding belongs only to its outer clip. Carry the authored
|
||||
# global text elsewhere without that binding; carrying every binding invents local frame
|
||||
# ownership, while rejecting the text loses the whole-video field. Subject sources and
|
||||
# ordinary references remain strict requirements, including frame-sourced subjects.
|
||||
scoped = replace(
|
||||
item,
|
||||
asset_ids=tuple(
|
||||
asset_id
|
||||
for asset_id in item.asset_ids
|
||||
if asset_id not in frame_assets or asset_id in target_asset_set
|
||||
),
|
||||
)
|
||||
if required_assets(scoped.subject_ids, scoped.asset_ids).issubset(target_asset_set):
|
||||
local_globals.append(scoped)
|
||||
census.append(
|
||||
SemanticCensusEntryV1(
|
||||
item.field_id, SemanticDispositionV1.GLOBAL_CARRIED, segment_id
|
||||
@@ -1401,6 +1418,33 @@ def assert_complete_semantic_census(
|
||||
SemanticDispositionV1.REJECTED,
|
||||
}:
|
||||
raise ProductionSemanticError("semantic_preservation_incomplete")
|
||||
# CRITICAL: source re-derivation alone permits a self-consistent plan with the frame moved
|
||||
# to another clip or removed everywhere. Each direct frame binding must survive in its
|
||||
# opening/closing owner, and the reference must never appear in another segment.
|
||||
for reference in authority.reference_definitions:
|
||||
if reference.role not in {AssetRole.FIRST_FRAME, AssetRole.LAST_FRAME}:
|
||||
continue
|
||||
if not slices:
|
||||
raise ProductionSemanticError("semantic_preservation_incomplete")
|
||||
owner = (
|
||||
min(slices, key=lambda item: item.global_start_milliseconds)
|
||||
if reference.role is AssetRole.FIRST_FRAME
|
||||
else max(slices, key=lambda item: item.global_end_milliseconds)
|
||||
)
|
||||
if reference.asset_id not in owner.asset_ids or any(
|
||||
reference.asset_id in item.asset_ids for item in slices if item is not owner
|
||||
):
|
||||
raise ProductionSemanticError("semantic_frame_owner_mismatch")
|
||||
owner_fields = {item.field_id: item for item in owner.global_fields}
|
||||
if any(
|
||||
reference.asset_id in field.asset_ids
|
||||
and (
|
||||
field.field_id not in owner_fields
|
||||
or reference.asset_id not in owner_fields[field.field_id].asset_ids
|
||||
)
|
||||
for field in authority.global_fields
|
||||
):
|
||||
raise ProductionSemanticError("semantic_preservation_incomplete")
|
||||
global_ids = (
|
||||
{item.subject_id for item in authority.subject_definitions}
|
||||
| {item.asset_id for item in authority.reference_definitions}
|
||||
|
||||
@@ -992,15 +992,26 @@ class ProductionStoryboardAdmissionService:
|
||||
)
|
||||
if isinstance(context, ProductionPlanningContextV2):
|
||||
_assert_canonical_cut_evidence(context, shots)
|
||||
parsed_semantics = clip_derived_semantics_removed(
|
||||
parse_canonical_semantics(candidate_text),
|
||||
typed_definitions=bool(
|
||||
semantic_authority.subject_definitions
|
||||
or semantic_authority.reference_definitions
|
||||
),
|
||||
)
|
||||
# CRITICAL: retained globals bind every reference and subject label. Bind
|
||||
# the re-parsed copy by the same rule before the strict equal-ID join;
|
||||
# normalizing only frame labels wrongly refuses other authored labels.
|
||||
bound = bind_canonical_semantic_references(
|
||||
replace(
|
||||
parsed_semantics,
|
||||
reference_definitions=semantic_authority.reference_definitions,
|
||||
subject_definitions=semantic_authority.subject_definitions,
|
||||
)
|
||||
)
|
||||
semantic_authority = merge_semantic_authorities(
|
||||
semantic_authority,
|
||||
clip_derived_semantics_removed(
|
||||
parse_canonical_semantics(candidate_text),
|
||||
typed_definitions=bool(
|
||||
semantic_authority.subject_definitions
|
||||
or semantic_authority.reference_definitions
|
||||
),
|
||||
),
|
||||
bound,
|
||||
)
|
||||
except ValueError:
|
||||
return StoryboardAdmissionRefusalV1(
|
||||
@@ -1515,7 +1526,15 @@ def _task_assets(
|
||||
return (
|
||||
(TaskMode.L2VA, last, len(last) == 1) if ordinal == count else (TaskMode.T2VA, (), True)
|
||||
)
|
||||
return TaskMode.REF2VA, references, bool(references)
|
||||
# CRITICAL: frame roles anchor the whole video, not every cut. Keep ordinary references in
|
||||
# registry order; repeating a frame here makes later clips claim the same opening/closing.
|
||||
local_references = tuple(
|
||||
item.asset_id
|
||||
for item in context.assets
|
||||
if (item.role is not AssetRole.FIRST_FRAME or ordinal == 1)
|
||||
and (item.role is not AssetRole.LAST_FRAME or ordinal == count)
|
||||
)
|
||||
return TaskMode.REF2VA, local_references, bool(local_references)
|
||||
|
||||
|
||||
def _clip_duration_seconds(allocation: SegmentDurationAllocationV1) -> Decimal:
|
||||
@@ -1706,6 +1725,22 @@ def _build_segmentation_proposal(
|
||||
)
|
||||
if type(duration_plan) is not SegmentDurationPlanV1: # pragma: no cover
|
||||
raise ProductionStoryboardError("proposal_duration_result")
|
||||
# CRITICAL: V1 has no canonical label-ownership authority. After frame filtering its labels
|
||||
# cannot be checked or safely renumbered; removing this guard silently misbinds the public
|
||||
# core route. Preserve stored admissions and single-clip identities instead of inventing binds.
|
||||
if (
|
||||
type(context) is ProductionPlanningContextV1
|
||||
and context.global_task_mode is TaskMode.REF2VA
|
||||
and len(duration_plan.allocations) > 1
|
||||
and any(
|
||||
item.role in {AssetRole.FIRST_FRAME, AssetRole.LAST_FRAME} for item in context.assets
|
||||
)
|
||||
):
|
||||
return SegmentationProposalRefusalV1(
|
||||
context.fingerprint,
|
||||
admission.fingerprint,
|
||||
SegmentationProposalRefusalCodeV1.SEMANTIC_PRESERVATION_UNAVAILABLE,
|
||||
)
|
||||
if native_modes is None:
|
||||
native_modes = frozenset(
|
||||
item.task_mode for item in build_default_native_mode_matrix().modes
|
||||
@@ -1743,6 +1778,17 @@ def _build_segmentation_proposal(
|
||||
referenced_assets = {asset for shot in assigned for asset in shot.asset_ids}
|
||||
if isinstance(admission, ProductionStoryboardAdmissionV2):
|
||||
referenced_subjects = {subject for shot in assigned for subject in shot.subject_ids}
|
||||
# CRITICAL: independent exact tuples are rendered even when absent from shot prose.
|
||||
# Derive their reference obligations here, not in admission: changing admission
|
||||
# bindings would invalidate stored single-segment identities.
|
||||
for shot in assigned:
|
||||
for text in (*shot.exact_dialogue, *shot.visible_text):
|
||||
referenced_assets.update(
|
||||
canonical_text_asset_ids(text, admission.semantic_authority)
|
||||
)
|
||||
referenced_subjects.update(
|
||||
canonical_text_subject_ids(text, admission.semantic_authority)
|
||||
)
|
||||
referenced_assets.update(
|
||||
asset
|
||||
for subject in admission.semantic_authority.subject_definitions
|
||||
@@ -1814,6 +1860,7 @@ def _build_segmentation_proposal(
|
||||
),
|
||||
clip_duration_seconds=_clip_duration_seconds(allocation),
|
||||
hard_constraints=context.hard_constraints,
|
||||
source_reference_definitions=admission.semantic_authority.reference_definitions,
|
||||
).text
|
||||
else:
|
||||
local_prompt, mappings = _render_local_prompt(context, allocation, assigned)
|
||||
@@ -2132,6 +2179,7 @@ class SegmentationProposalV2(SegmentationProposalV1):
|
||||
),
|
||||
clip_duration_seconds=_clip_duration_seconds(segment.duration),
|
||||
hard_constraints=self.hard_constraints,
|
||||
source_reference_definitions=self.semantic_authority.reference_definitions,
|
||||
)
|
||||
if rendered.text != segment.local_prompt:
|
||||
raise ProductionStoryboardError("proposal_semantic_render_mismatch")
|
||||
|
||||
@@ -552,7 +552,9 @@ def build_default_reachability_manifest(
|
||||
)
|
||||
for mode in TaskMode
|
||||
)
|
||||
native_supported = {TaskMode.T2VA, TaskMode.FL2VA, TaskMode.REF2VA}
|
||||
# IMPORTANT: mirror the native adapter's complete dispatch, including single keyframes;
|
||||
# a stale partial mode list hides working I2VA/L2VA routes from public reachability.
|
||||
native_supported = set(TaskMode)
|
||||
entries.extend(
|
||||
_mode_entry(
|
||||
stage=ReachabilityStage.NATIVE_GENERATION,
|
||||
|
||||
@@ -921,9 +921,10 @@ def _validate_font_facts(
|
||||
raise _reject("font_asset_unsupported", "title font is outside packaged fallback order")
|
||||
if binding.weight != clip.text.weight or binding.style != clip.text.style:
|
||||
raise _reject("font_style_unsupported", "title style lacks packaged font authority")
|
||||
if binding.font_asset_id != clip.text.font_asset_id or binding.text_fingerprint != (
|
||||
canonical_fingerprint({"content": clip.text.content})
|
||||
):
|
||||
# CRITICAL: authoring_render_source._require_resolved_font_bindings validates the
|
||||
# requested-to-resolved relation before planning. Restoring id equality here rejects
|
||||
# valid regional fallback, whose resolved id differs from the requested id.
|
||||
if binding.text_fingerprint != (canonical_fingerprint({"content": clip.text.content})):
|
||||
raise _reject("font_glyph_unsupported", "title text lacks packaged glyph authority")
|
||||
|
||||
|
||||
@@ -1077,7 +1078,12 @@ def plan_render(
|
||||
font_facts: PackagedFontFacts,
|
||||
renderer_profile: RendererCapabilityProfile | None = None,
|
||||
) -> RenderPlanV1:
|
||||
"""Build one deterministic plan without executing or qualifying a renderer."""
|
||||
"""Build one deterministic plan without executing or qualifying a renderer.
|
||||
|
||||
Production callers must first validate the requested-to-resolved font relation with
|
||||
authoring_render_source._require_resolved_font_bindings. Resolved regional fallback ids
|
||||
may differ from requested ids; restoring id equality here would reject valid titles.
|
||||
"""
|
||||
|
||||
if type(snapshot) is not PublicCompositionSnapshot:
|
||||
raise _reject("invalid_contract", "render planner requires a typed public snapshot")
|
||||
|
||||
@@ -48,6 +48,7 @@ from .intent_graph import (
|
||||
from .production_semantics import (
|
||||
ProductionLocalShotV1,
|
||||
ProductionSemanticSliceV1,
|
||||
ReferenceDefinitionV1,
|
||||
)
|
||||
from .profiles import DurationAlignment, PromptProfileRegistry, default_profile_registry
|
||||
|
||||
@@ -609,6 +610,13 @@ _ROLE_PROSE: dict[AssetRole, str] = {
|
||||
AssetRole.AUDIO_SOURCE: "the supplied audio track",
|
||||
}
|
||||
|
||||
# A non-owner clip can retain plan-level frame context without claiming that frame locally.
|
||||
# These whole-video phrases must not reuse the clip-scoped descriptions in `_ROLE_PROSE`.
|
||||
_WHOLE_VIDEO_FRAME_PROSE = {
|
||||
AssetRole.FIRST_FRAME: "the opening frame of the full video",
|
||||
AssetRole.LAST_FRAME: "the closing frame of the full video",
|
||||
}
|
||||
|
||||
_GENERIC_REFERENCE_PROSE: dict[MediaKind, str] = {
|
||||
MediaKind.IMAGE: "a supplied visual reference",
|
||||
MediaKind.VIDEO: "a supplied video reference",
|
||||
@@ -1096,6 +1104,7 @@ def render_production_segment_prompt(
|
||||
section_heading: str,
|
||||
clip_duration_seconds: Decimal,
|
||||
hard_constraints: tuple[str, ...] = (),
|
||||
source_reference_definitions: tuple[ReferenceDefinitionV1, ...] = (),
|
||||
) -> ProductionSegmentPromptV1:
|
||||
"""Render one sliced proposal using only canonical headings and shot notation.
|
||||
|
||||
@@ -1129,6 +1138,10 @@ def render_production_segment_prompt(
|
||||
isinstance(value, str) and value and "\x00" not in value for value in hard_constraints
|
||||
):
|
||||
raise PromptRenderingError("Production hard constraints must be exact bounded text")
|
||||
if not isinstance(source_reference_definitions, tuple) or not all(
|
||||
isinstance(value, ReferenceDefinitionV1) for value in source_reference_definitions
|
||||
):
|
||||
raise PromptRenderingError("Production source references must be typed definitions")
|
||||
if (
|
||||
not isinstance(clip_duration_seconds, Decimal)
|
||||
or not clip_duration_seconds.is_finite()
|
||||
@@ -1242,9 +1255,9 @@ def render_production_segment_prompt(
|
||||
)
|
||||
if not sections:
|
||||
raise PromptRenderingError("Production rendering produced no canonical sections")
|
||||
# CRITICAL: a local clip has its own ordered asset registry. A last-frame asset that was
|
||||
# global Picture 2 becomes local Picture 1; substitute exact tokens once, never substring
|
||||
# replacements that cascade or alter protected dialogue/visible text.
|
||||
# CRITICAL: local renumbering and absent-frame projection share one token pass. A second
|
||||
# pass can project an already-renumbered ordinary image as a missing frame. Projection is
|
||||
# global-field-only and whole-video-scoped; shot/timed text keeps strict local obligations.
|
||||
local_counts = {kind: 0 for kind in MediaKind}
|
||||
names = {MediaKind.IMAGE: "Picture", MediaKind.VIDEO: "Video", MediaKind.AUDIO: "Audio"}
|
||||
local_labels: dict[str, str] = {}
|
||||
@@ -1253,15 +1266,35 @@ def render_production_segment_prompt(
|
||||
local_labels[reference.backend_label] = (
|
||||
f"<{names[reference.kind]} {local_counts[reference.kind]}>"
|
||||
)
|
||||
if local_labels:
|
||||
token_pattern = re.compile("|".join(re.escape(value) for value in local_labels))
|
||||
sections = tuple(
|
||||
replace(
|
||||
section,
|
||||
body=token_pattern.sub(lambda match: local_labels[match.group()], section.body),
|
||||
)
|
||||
for section in sections
|
||||
global_labels = dict(local_labels)
|
||||
for reference in source_reference_definitions:
|
||||
if (
|
||||
reference.role in _WHOLE_VIDEO_FRAME_PROSE
|
||||
and reference.asset_id not in semantic_slice.asset_ids
|
||||
):
|
||||
global_labels[reference.backend_label] = _WHOLE_VIDEO_FRAME_PROSE[reference.role]
|
||||
patterns = {
|
||||
False: re.compile("|".join(re.escape(value) for value in local_labels))
|
||||
if local_labels
|
||||
else None,
|
||||
True: re.compile("|".join(re.escape(value) for value in global_labels))
|
||||
if global_labels
|
||||
else None,
|
||||
}
|
||||
|
||||
def substitute_labels(value: str, *, global_field: bool = False) -> str:
|
||||
pattern = patterns[global_field]
|
||||
labels = global_labels if global_field else local_labels
|
||||
return pattern.sub(lambda match: labels[match.group()], value) if pattern else value
|
||||
|
||||
global_headings = {field.heading for field in semantic_slice.global_fields}
|
||||
sections = tuple(
|
||||
replace(
|
||||
section,
|
||||
body=substitute_labels(section.body, global_field=section.heading in global_headings),
|
||||
)
|
||||
for section in sections
|
||||
)
|
||||
# The preamble is written with the clip's own labels already, so it takes no part in the
|
||||
# substitution above: a second pass would renumber a local label as if it were a source one.
|
||||
preamble = _production_alignment(
|
||||
@@ -1270,7 +1303,9 @@ def render_production_segment_prompt(
|
||||
text = render_prompt_sections(sections, preamble=preamble)
|
||||
for shot in shots:
|
||||
for exact in (*shot.exact_dialogue, *shot.visible_text):
|
||||
if exact not in text:
|
||||
# CRITICAL: only canonical label tokens may change. Always check the same one-pass
|
||||
# local substitution, even without source references; all other bytes stay exact.
|
||||
if substitute_labels(exact) not in text:
|
||||
raise PromptRenderingError("Production rendering lost exact text")
|
||||
return ProductionSegmentPromptV1(text=text, sections=sections)
|
||||
|
||||
|
||||
@@ -11,6 +11,39 @@ class UnsafePathError(ValueError):
|
||||
"""Raised when a filesystem path crosses an unsafe component."""
|
||||
|
||||
|
||||
def _native_io_path(path: Path, *, force: bool = False) -> Path:
|
||||
if os.name != "nt":
|
||||
return path
|
||||
value = str(path)
|
||||
extended = value.startswith("\\\\?\\")
|
||||
if value.startswith("\\\\.\\") or (
|
||||
extended
|
||||
and not (
|
||||
value.startswith("\\\\?\\UNC\\")
|
||||
or (
|
||||
len(value) >= 7
|
||||
and value[4].isascii()
|
||||
and value[4].isalpha()
|
||||
and value[5:7] == ":\\"
|
||||
)
|
||||
)
|
||||
):
|
||||
raise UnsafePathError("unsupported native path namespace")
|
||||
if (
|
||||
not extended
|
||||
and not force
|
||||
and len(value.encode("utf-16-le", errors="surrogatepass")) // 2 < 248
|
||||
):
|
||||
return path
|
||||
if not path.is_absolute() or ".." in path.parts:
|
||||
raise UnsafePathError("native path must be lexically absolute")
|
||||
if extended:
|
||||
return path
|
||||
# CRITICAL: convert only syscall operands; resolving here could cross a reparse point,
|
||||
# and persisting this spelling would change logical identities and public path contracts.
|
||||
return Path("\\\\?\\UNC\\" + value[2:] if value.startswith("\\\\") else "\\\\?\\" + value)
|
||||
|
||||
|
||||
def _absolute_lexical(path: Path) -> Path:
|
||||
if not isinstance(path, Path):
|
||||
raise UnsafePathError("path must be a pathlib.Path")
|
||||
@@ -23,7 +56,7 @@ def _absolute_lexical(path: Path) -> Path:
|
||||
def _is_link_or_reparse(path: Path, metadata: os.stat_result) -> bool:
|
||||
attributes = getattr(metadata, "st_file_attributes", 0)
|
||||
return bool(
|
||||
path.is_symlink()
|
||||
_native_io_path(path).is_symlink()
|
||||
or stat.S_ISLNK(metadata.st_mode)
|
||||
or (attributes & stat.FILE_ATTRIBUTE_REPARSE_POINT)
|
||||
)
|
||||
@@ -38,7 +71,7 @@ def validate_path_components(path: Path) -> tuple[Path, os.stat_result]:
|
||||
for part in candidate.parts[1:]:
|
||||
current /= part
|
||||
try:
|
||||
metadata = current.lstat()
|
||||
metadata = _native_io_path(current).lstat()
|
||||
except OSError as exc:
|
||||
raise UnsafePathError("path component is missing or unavailable") from exc
|
||||
# CRITICAL: never replace lstat/reparse checks with resolving or leaf-only inspection.
|
||||
@@ -46,7 +79,7 @@ def validate_path_components(path: Path) -> tuple[Path, os.stat_result]:
|
||||
raise UnsafePathError("path contains a link or reparse component")
|
||||
if metadata is None:
|
||||
try:
|
||||
metadata = current.lstat()
|
||||
metadata = _native_io_path(current).lstat()
|
||||
except OSError as exc:
|
||||
raise UnsafePathError("path is missing or unavailable") from exc
|
||||
if _is_link_or_reparse(current, metadata):
|
||||
@@ -72,7 +105,7 @@ def read_regular_file_bytes(path: Path, *, maximum_bytes: int) -> bytes:
|
||||
|
||||
candidate = validate_regular_file(path, maximum_bytes=maximum_bytes)
|
||||
try:
|
||||
with candidate.open("rb") as stream:
|
||||
with _native_io_path(candidate).open("rb") as stream:
|
||||
payload = stream.read(maximum_bytes + 1)
|
||||
except OSError as exc:
|
||||
raise UnsafePathError("regular file cannot be read") from exc
|
||||
@@ -98,11 +131,11 @@ def ensure_directory(path: Path) -> Path:
|
||||
for part in candidate.parts[1:]:
|
||||
current /= part
|
||||
try:
|
||||
metadata = current.lstat()
|
||||
metadata = _native_io_path(current).lstat()
|
||||
except FileNotFoundError:
|
||||
try:
|
||||
current.mkdir()
|
||||
metadata = current.lstat()
|
||||
_native_io_path(current).mkdir()
|
||||
metadata = _native_io_path(current).lstat()
|
||||
except OSError as exc:
|
||||
raise UnsafePathError("directory component cannot be created") from exc
|
||||
except OSError as exc:
|
||||
@@ -123,7 +156,7 @@ def prepare_regular_output(path: Path) -> Path:
|
||||
parent = ensure_directory(path.parent)
|
||||
target = parent / path.name
|
||||
try:
|
||||
metadata = target.lstat()
|
||||
metadata = _native_io_path(target).lstat()
|
||||
except FileNotFoundError:
|
||||
return target
|
||||
except OSError as exc:
|
||||
|
||||
@@ -681,13 +681,13 @@ _TEXT_FONT: Final = (
|
||||
"fallback",
|
||||
"Åß",
|
||||
"coverage is resolved by walking the packaged fallback order and never from a system "
|
||||
"font; the packaged manifest declares exactly one family, so this row cannot observe a "
|
||||
"second-family substitution and does not claim to",
|
||||
"font; this Latin witness retains its primary-family face and does not claim a "
|
||||
"regional substitution",
|
||||
),
|
||||
(
|
||||
"unsupported_glyph",
|
||||
"A中",
|
||||
"U+4E2D is outside every packaged coverage profile, so the accepted behaviour is the "
|
||||
"Aሀ",
|
||||
"U+1200 is outside every packaged coverage profile, so the accepted behaviour is the "
|
||||
"explicit font_glyph_unsupported refusal when the plan is bound, never a silent "
|
||||
"substitution",
|
||||
),
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
© 2014-2021 Adobe (http://www.adobe.com/).
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License,
|
||||
Version 1.1.
|
||||
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font
|
||||
creation efforts of academic and linguistic communities, and to
|
||||
provide a free and open framework in which fonts may be shared and
|
||||
improved in partnership with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply to
|
||||
any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software
|
||||
components as distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to,
|
||||
deleting, or substituting -- in part or in whole -- any of the
|
||||
components of the Original Version, by changing formats or by porting
|
||||
the Font Software to a new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed,
|
||||
modify, redistribute, and sell modified and unmodified copies of the
|
||||
Font Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components, in
|
||||
Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the
|
||||
corresponding Copyright Holder. This restriction only applies to the
|
||||
primary font name as presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created using
|
||||
the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
+16
-1
@@ -9,6 +9,21 @@ maintainer records, dependency installations and generated test results are excl
|
||||
Run commands from the package root. Use Python 3.10 or newer, a project-local virtual environment,
|
||||
Node.js 24 and pnpm 11.3.0, as declared in `frontend/package.json`.
|
||||
|
||||
Use LF line endings for text files; `.gitattributes` enforces checkout policy on every platform.
|
||||
|
||||
A Windows clone made before release 1.4.5, which introduced this policy, may keep Windows line
|
||||
endings in files the update did not touch, causing build-provenance tests to reject the source
|
||||
digest. Make a fresh clone, or
|
||||
commit or stash uncommitted changes, confirm `git status` is clean, and run these commands once
|
||||
before running tests:
|
||||
|
||||
```powershell
|
||||
git rm --cached -r -q .
|
||||
git reset --hard
|
||||
```
|
||||
|
||||
`git reset --hard` discards uncommitted changes.
|
||||
|
||||
Windows PowerShell:
|
||||
|
||||
```powershell
|
||||
@@ -183,7 +198,7 @@ Build a Python source distribution from a Git checkout whose reviewed public inp
|
||||
|
||||
```powershell
|
||||
& .\.venv\Scripts\python.exe -m build --sdist
|
||||
& .\.venv\Scripts\python.exe scripts/sdist_payload.py --archive dist/minimax_h3_studio-1.4.0.tar.gz
|
||||
& .\.venv\Scripts\python.exe scripts/sdist_payload.py --archive dist/minimax_h3_studio-1.4.6.tar.gz
|
||||
```
|
||||
|
||||
The standard build backend copies public tracked files into a fresh temporary tree and respects
|
||||
|
||||
@@ -17,6 +17,11 @@ draft recovery. Project format version 1 remains in use, but a project or saved
|
||||
directional wipe requires version 1.4.0 or later. Version 1.3.2 and earlier refuse such a project
|
||||
rather than silently dropping the wipe.
|
||||
|
||||
Titles in Traditional Chinese, Simplified Chinese, Japanese or Korean are preserved by Save/Open
|
||||
and draft recovery. Project format version 1 remains in use, but editing or rendering such a title
|
||||
requires version 1.4.5 or later. Versions 1.4.0 and 1.4.1 open the project and keep the text, but
|
||||
refuse to edit or render those titles.
|
||||
|
||||
## Save And Open
|
||||
|
||||
**Save project** uses the browser's native save picker when available. **File written** means
|
||||
|
||||
@@ -10,3 +10,6 @@ tests/fixtures/m25_20_semantic_media/
|
||||
.planning/
|
||||
.tmp/
|
||||
../comfyui_h3_context/web/
|
||||
|
||||
# JSON.stringify owns this byte-pinned baseline serialization.
|
||||
tests/fixtures/managedT2vaGraph.json
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
export const MARKER_MARGIN = 128;
|
||||
|
||||
interface AudioMarker {
|
||||
readonly start: number;
|
||||
readonly end: number;
|
||||
}
|
||||
|
||||
interface AudioWindow {
|
||||
readonly start_sample: number;
|
||||
readonly sample_count: number;
|
||||
}
|
||||
|
||||
export function isNearAudioMarker(
|
||||
start: number,
|
||||
windowSamples: number,
|
||||
marker: AudioMarker,
|
||||
): boolean {
|
||||
// GUARD: keep measured preview windows at least one render quantum from the marker.
|
||||
// An overlap-only check admits a window ending at the marker, where preview energy bleeds in.
|
||||
return (
|
||||
start < marker.end + MARKER_MARGIN &&
|
||||
start + windowSamples > marker.start - MARKER_MARGIN
|
||||
);
|
||||
}
|
||||
|
||||
export function chooseClipAudioWindow<T extends AudioWindow>(
|
||||
envelopes: readonly T[],
|
||||
{
|
||||
nominal,
|
||||
centre,
|
||||
cut,
|
||||
windowSamples,
|
||||
marker,
|
||||
name,
|
||||
}: {
|
||||
nominal: number;
|
||||
centre: number;
|
||||
cut: number;
|
||||
windowSamples: number;
|
||||
marker: AudioMarker;
|
||||
name: string;
|
||||
},
|
||||
) {
|
||||
const missing = () => new Error(`the capture has no full window at ${name}`);
|
||||
if (envelopes[nominal] === undefined) throw missing();
|
||||
const clipStartOf = (index: number) =>
|
||||
Math.round(envelopes[index]!.start_sample - cut);
|
||||
const excluded = (index: number) =>
|
||||
isNearAudioMarker(clipStartOf(index), windowSamples, marker);
|
||||
const index = !excluded(nominal)
|
||||
? nominal
|
||||
: [nominal - 1, nominal + 1]
|
||||
.filter(
|
||||
(candidate) =>
|
||||
envelopes[candidate] !== undefined && !excluded(candidate),
|
||||
)
|
||||
.sort(
|
||||
(left, right) =>
|
||||
Math.abs(clipStartOf(left) + windowSamples / 2 - centre) -
|
||||
Math.abs(clipStartOf(right) + windowSamples / 2 - centre),
|
||||
)[0];
|
||||
const envelope = index === undefined ? undefined : envelopes[index];
|
||||
if (envelope === undefined || envelope.sample_count !== windowSamples)
|
||||
throw missing();
|
||||
return {
|
||||
envelope,
|
||||
index,
|
||||
clipStartSample: Math.round(envelope.start_sample - cut),
|
||||
markerAvoided: index !== nominal,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Frame sequence contract harness</title>
|
||||
</head>
|
||||
<body>
|
||||
<main aria-label="Frame sequence contract">
|
||||
<button id="generate">Generate approved sequence</button>
|
||||
<button id="terminal">Complete current child</button>
|
||||
<button id="change">Change source identity</button>
|
||||
<output id="status">idle</output>
|
||||
</main>
|
||||
<script type="module" src="./frameSequence.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,443 @@
|
||||
import {
|
||||
AppModeError,
|
||||
createAppModeController,
|
||||
type AppModeInputs,
|
||||
} from "../src/host/appMode";
|
||||
import {
|
||||
ManagedSequenceClientError,
|
||||
decodeManagedSequenceMutationResult,
|
||||
} from "../src/host/managedSequenceClient";
|
||||
import {
|
||||
canonicalStringFingerprint,
|
||||
sha256Text,
|
||||
} from "../src/contracts/canonicalFingerprint";
|
||||
import { createProductionManagedChildResolver } from "../src/host/productionManagedChildResolver";
|
||||
import type { OwnedGraphReference } from "../src/host/ownedGraphIdentity";
|
||||
import {
|
||||
ManagedSerialSequenceRunnerError,
|
||||
type ManagedSerialSequenceStartIntent,
|
||||
} from "../src/host/managedSequenceRunnerContract";
|
||||
import { loadAvailableProfile } from "../tests/support/generationProfileFixture";
|
||||
import { fixtureBackedAppModeHost } from "../tests/support/hostSeamTestDouble";
|
||||
import {
|
||||
acceptedQueueResponse,
|
||||
syntheticPromptUuid,
|
||||
} from "../tests/support/queuePromptTestDouble";
|
||||
import { preparedSequenceMediaFixture } from "../tests/support/preparedSequenceMediaFixture";
|
||||
import { compileSequenceWorkflow } from "../tests/support/sequenceCompileFixture";
|
||||
import { nativeCanvasSequenceTemplateFixture } from "../tests/support/nativeCanvasSequenceTemplateFixture";
|
||||
import type { Json } from "../tests/support/templateFixture";
|
||||
import { createManagedSequenceHarnessEngine } from "./managedSequence";
|
||||
|
||||
const search = new URLSearchParams(location.search);
|
||||
const selected = search.get("task");
|
||||
if (selected !== "i2va" && selected !== "l2va" && selected !== "fl2va")
|
||||
throw new Error("explicit frame mode required");
|
||||
const mode = selected;
|
||||
const cropped = search.get("crop") === "true";
|
||||
const fp = (digit: string) => `sha256:${digit.repeat(64)}`;
|
||||
const profile = { name: "h3_base", version: "1.0" };
|
||||
const retained = preparedSequenceMediaFixture(mode, mode, cropped).prepared
|
||||
.bindings!;
|
||||
const activeWorkflow = {};
|
||||
let visible: Json = {
|
||||
nodes: [
|
||||
{
|
||||
id: 1,
|
||||
type: "H3ContextRequest",
|
||||
mode: 0,
|
||||
widgets_values: ["synthetic"],
|
||||
inputs: [],
|
||||
outputs: [],
|
||||
},
|
||||
{ id: 2, type: "MiniMaxH3ImageToVideo", mode: 0, inputs: [], outputs: [] },
|
||||
],
|
||||
links: [],
|
||||
groups: [],
|
||||
config: {},
|
||||
extra: {},
|
||||
version: 0.4,
|
||||
};
|
||||
let owned: OwnedGraphReference = {
|
||||
nodeIds: ["1", "2"],
|
||||
linkIds: [],
|
||||
anchorNodeId: "2",
|
||||
authoredWidgetNodeIds: ["1"],
|
||||
};
|
||||
let queues = 0,
|
||||
writes = 0,
|
||||
observations = 0,
|
||||
reads = 0,
|
||||
starts = 0;
|
||||
let changed = false,
|
||||
lastFailure: string | null = null;
|
||||
type BridgeStage = "parent" | "resolver" | "controller" | "runner" | "bridge";
|
||||
let stage: BridgeStage = "bridge";
|
||||
let failureStage: BridgeStage | null = null;
|
||||
let failureName: string | null = null;
|
||||
function recordFailure(error: unknown) {
|
||||
lastFailure =
|
||||
error instanceof AppModeError ||
|
||||
error instanceof ManagedSequenceClientError ||
|
||||
error instanceof ManagedSerialSequenceRunnerError
|
||||
? error.code
|
||||
: "unexpected";
|
||||
const name = error instanceof Error ? error.name : "other";
|
||||
failureName = /^[A-Za-z][A-Za-z0-9_]{0,63}$/.test(name) ? name : "other";
|
||||
failureStage = stage;
|
||||
}
|
||||
let currentTask: AppModeInputs["task_mode"] = mode;
|
||||
const observedReceiptHandles: string[] = [];
|
||||
const childModes: string[] = [];
|
||||
const bindCounts: number[] = [];
|
||||
const queuedGuideIndices: number[][] = [];
|
||||
const host = fixtureBackedAppModeHost(
|
||||
{
|
||||
extensionManager: {
|
||||
workflow: { activeWorkflow, openWorkflows: [activeWorkflow] },
|
||||
},
|
||||
loadApiJson: async () => undefined,
|
||||
loadGraphData: async (value: unknown) => {
|
||||
visible = structuredClone(value) as Json;
|
||||
writes += 1;
|
||||
},
|
||||
graphToPrompt: async (value?: unknown) =>
|
||||
compileSequenceWorkflow((value ?? visible) as Json, false),
|
||||
graph: { serialize: () => visible },
|
||||
},
|
||||
{
|
||||
queuePrompt: async () => {
|
||||
queues += 1;
|
||||
queuedGuideIndices.push(
|
||||
(visible.nodes as Json[])
|
||||
.filter((node) => node.type === "MiniMaxH3AddGuide")
|
||||
.map((node) => Number((node.widgets_values as unknown[])[0])),
|
||||
);
|
||||
return acceptedQueueResponse(200 + queues);
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
async function loadTemplate(name: string) {
|
||||
const template = nativeCanvasSequenceTemplateFixture(name);
|
||||
const nodes = template.nodes as Json[],
|
||||
links = template.links as unknown[][];
|
||||
const anchor = nodes.find((node) => node.id === 3)!;
|
||||
(anchor.inputs as Json[]).find((port) => port.name === "clip")!.link = 24;
|
||||
nodes.find((node) => node.id === 25)!.widgets_values = [
|
||||
"synthetic.safetensors",
|
||||
];
|
||||
nodes.push({
|
||||
id: 27,
|
||||
type: "CLIPLoader",
|
||||
inputs: [],
|
||||
outputs: [{ name: "CLIP", type: "CLIP", links: [24] }],
|
||||
widgets_values: ["synthetic.safetensors", "minimax_h3"],
|
||||
});
|
||||
(nodes.find((node) => node.id === 4)!.inputs as Json[]).push({
|
||||
name: "vae",
|
||||
type: "VAE",
|
||||
link: 25,
|
||||
});
|
||||
(
|
||||
(nodes.find((node) => node.id === 25)!.outputs as Json[])[0]!
|
||||
.links as number[]
|
||||
).push(25);
|
||||
links.push([24, 27, 0, 3, 0, "CLIP"], [25, 25, 0, 4, 1, "VAE"]);
|
||||
template.last_node_id = Math.max(Number(template.last_node_id), 27);
|
||||
template.last_link_id = Math.max(Number(template.last_link_id), 25);
|
||||
return template;
|
||||
}
|
||||
const controller = createAppModeController(host.app, host.api, {
|
||||
loadProfile: loadAvailableProfile,
|
||||
loadTemplate,
|
||||
readNodeDefinitions: () =>
|
||||
cropped
|
||||
? {
|
||||
ImageCropV2: {
|
||||
nodeData: {
|
||||
name: "ImageCropV2",
|
||||
input: {
|
||||
required: { image: ["IMAGE"], crop_region: ["BOUNDING_BOX"] },
|
||||
},
|
||||
output: ["IMAGE"],
|
||||
},
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
nodeDefinitionReadinessReached: () => cropped,
|
||||
});
|
||||
const resolver = createProductionManagedChildResolver({
|
||||
app: host.app,
|
||||
currentOwnedGraphReference: () => owned,
|
||||
fetchApi: async (_route, options) => {
|
||||
reads += 1;
|
||||
const request = JSON.parse(String(options?.body)) as {
|
||||
payload: Record<string, unknown>;
|
||||
};
|
||||
const payload = request.payload;
|
||||
const index = payload.segment_id === "segment.1" ? 0 : 1;
|
||||
const task =
|
||||
mode === "i2va"
|
||||
? index === 0
|
||||
? "i2va"
|
||||
: "t2va"
|
||||
: mode === "l2va"
|
||||
? index === 1
|
||||
? "l2va"
|
||||
: "t2va"
|
||||
: index === 0
|
||||
? "i2va"
|
||||
: "l2va";
|
||||
const roles =
|
||||
task === "i2va" ? ["first_frame"] : task === "l2va" ? ["last_frame"] : [];
|
||||
const entries = retained.entries.filter(
|
||||
(row) => roles.includes(row.role) || mode === "i2va",
|
||||
);
|
||||
const canonicalPrompt = "A blue sphere turns slowly.";
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
schema: "h3.context.managed_prepared_context.v2",
|
||||
parent_sequence_id: payload.parent_sequence_id,
|
||||
parent_revision: payload.expected_revision,
|
||||
authorization_fingerprint: payload.authorization_fingerprint,
|
||||
segment_id: payload.segment_id,
|
||||
eligible_execution_fingerprint: payload.eligible_execution_fingerprint,
|
||||
materialization_receipt_fingerprint:
|
||||
payload.materialization_receipt_fingerprint,
|
||||
context_workspace_handle: payload.context_workspace_handle,
|
||||
context_report_id: `report.${index + 1}`,
|
||||
context_report_revision: 1,
|
||||
context_report_fingerprint: fp("4"),
|
||||
canonical_prompt: canonicalPrompt,
|
||||
canonical_prompt_fingerprint:
|
||||
canonicalStringFingerprint(canonicalPrompt),
|
||||
task_mode: task,
|
||||
duration_milliseconds: 6000,
|
||||
frame_count: 158,
|
||||
profile,
|
||||
profile_fingerprint: sha256Text(JSON.stringify(profile)),
|
||||
ordered_references: roles.map((role, i) => ({
|
||||
asset_id: `${role}_1`,
|
||||
kind: "image",
|
||||
role,
|
||||
connection_order: i + 1,
|
||||
metadata: null,
|
||||
paired_video_id: null,
|
||||
})),
|
||||
reference_registry_fingerprint: fp("5"),
|
||||
native_binding_fingerprint: fp("6"),
|
||||
sequence_task_mode: mode,
|
||||
geometry_donor_asset_id: mode === "i2va" ? "first_frame_1" : null,
|
||||
media_bindings: entries.length
|
||||
? { schema: retained.schema, entries }
|
||||
: null,
|
||||
canonical_lowering: {
|
||||
schema:
|
||||
task === "t2va"
|
||||
? "h3.context.production_canonical_lowering.v1"
|
||||
: "h3.context.production_canonical_lowering.v2",
|
||||
base_report_fingerprint: fp("7"),
|
||||
base_report_revision: 0,
|
||||
override_revision: 1,
|
||||
reason: "Materialize approved Production segment prompt",
|
||||
...(task === "t2va" ? {} : { task_mode: task, binding_roles: roles }),
|
||||
},
|
||||
}),
|
||||
{ status: 200, headers: { "content-type": "application/json" } },
|
||||
);
|
||||
},
|
||||
});
|
||||
const engine = createManagedSequenceHarnessEngine({
|
||||
workflowAuthority: activeWorkflow,
|
||||
resolveChild: async (...args) => {
|
||||
stage = "resolver";
|
||||
return resolver(...args);
|
||||
},
|
||||
startChild: async (inputs, options) => {
|
||||
starts += 1;
|
||||
currentTask = inputs.task_mode;
|
||||
childModes.push(inputs.task_mode);
|
||||
stage = "controller";
|
||||
const prepare = options!.prepareManaged!;
|
||||
try {
|
||||
return await controller.start(inputs, {
|
||||
...options,
|
||||
observeSourceIdentity: async (request) => {
|
||||
observations += 1;
|
||||
const entry = retained.entries.find(
|
||||
(row) => row.locator === request.locator,
|
||||
)!;
|
||||
const handle = "ig_" + String(observations).padStart(40, "0");
|
||||
observedReceiptHandles.push(handle);
|
||||
return {
|
||||
...entry.source_identity,
|
||||
receipt_handle: handle,
|
||||
source_fingerprint: changed
|
||||
? fp("f")
|
||||
: entry.source_identity.source_fingerprint,
|
||||
};
|
||||
},
|
||||
prepareManaged: async (preflight) => {
|
||||
bindCounts.push(observations);
|
||||
stage = "parent";
|
||||
const authority = await prepare(preflight);
|
||||
stage = "controller";
|
||||
return {
|
||||
...authority,
|
||||
bindCanvasIdentity(identity) {
|
||||
owned = identity.ownedReference;
|
||||
authority.bindCanvasIdentity?.(identity);
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
recordFailure(error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
});
|
||||
// IMPORTANT: the shared authority engine emits T2VA V1 by default. A frame fixture must
|
||||
// publish its actual global V2 mode; relabelling the Start intent alone is correctly refused.
|
||||
const sendParent = engine.parentClient.send;
|
||||
let checkedParentRoundTrip = false;
|
||||
function ordered(value: unknown): unknown {
|
||||
if (Array.isArray(value)) return value.map(ordered);
|
||||
if (value !== null && typeof value === "object")
|
||||
return Object.fromEntries(
|
||||
Object.entries(value)
|
||||
.sort(([a], [b]) => a.localeCompare(b))
|
||||
.map(([key, item]) => [key, ordered(item)]),
|
||||
);
|
||||
return value;
|
||||
}
|
||||
Object.assign(engine.parentClient, {
|
||||
send: async (...args: Parameters<typeof sendParent>) => {
|
||||
stage = "parent";
|
||||
const result = await sendParent(...args);
|
||||
const failure =
|
||||
args[1] === "fail_prepared_child" ? args[2].failure_code : null;
|
||||
if (
|
||||
failure !== null &&
|
||||
failure !== undefined &&
|
||||
failure !== "sequence_media_changed" &&
|
||||
failure !== "sequence_media_unavailable"
|
||||
)
|
||||
throw new Error("invalid synthetic frame failure");
|
||||
stage = "runner";
|
||||
const intended = Object.freeze({
|
||||
...result,
|
||||
schema: "h3.context.managed_sequence_result.v2" as const,
|
||||
sequenceTaskMode: mode,
|
||||
failureCode: failure ?? null,
|
||||
});
|
||||
const execution = result.execution;
|
||||
const child = result.childAuthority;
|
||||
const decoded = decodeManagedSequenceMutationResult(
|
||||
{
|
||||
schema: intended.schema,
|
||||
parent_sequence_id: result.parentSequenceId,
|
||||
authorization_fingerprint: result.authorizationFingerprint,
|
||||
read_authority_fingerprint: result.readAuthorityFingerprint,
|
||||
state: result.state,
|
||||
revision: result.revision,
|
||||
execution:
|
||||
execution === null
|
||||
? null
|
||||
: {
|
||||
schema: "h3.context.eligible_segment_execution.v1",
|
||||
parent_sequence_id: execution.parentSequenceId,
|
||||
parent_authorization_fingerprint:
|
||||
execution.parentAuthorizationFingerprint,
|
||||
segment_id: execution.segmentId,
|
||||
slot_revision: execution.slotRevision,
|
||||
attempt_epoch: execution.attemptEpoch,
|
||||
materialization_receipt_fingerprint:
|
||||
execution.materializationReceiptFingerprint,
|
||||
predecessor_terminal_fingerprint:
|
||||
execution.predecessorTerminalFingerprint,
|
||||
request_id: execution.requestId,
|
||||
job_count: execution.jobCount,
|
||||
},
|
||||
execution_fingerprint: execution?.fingerprint ?? null,
|
||||
child_authority:
|
||||
child === null
|
||||
? null
|
||||
: {
|
||||
schema: child.schema,
|
||||
run_handle: child.runHandle,
|
||||
state_fingerprint: child.stateFingerprint,
|
||||
job_id: child.jobId,
|
||||
transaction_id: child.transactionId,
|
||||
},
|
||||
context_workspace_handle: result.contextWorkspaceHandle,
|
||||
parent_expires_at_epoch_ms: result.parentExpiresAtEpochMs,
|
||||
replayed: result.replayed,
|
||||
sequence_task_mode: intended.sequenceTaskMode,
|
||||
failure_code: intended.failureCode,
|
||||
},
|
||||
mode,
|
||||
);
|
||||
if (!checkedParentRoundTrip) {
|
||||
if (
|
||||
JSON.stringify(ordered(decoded)) !== JSON.stringify(ordered(intended))
|
||||
)
|
||||
throw new Error("synthetic parent round trip mismatch");
|
||||
checkedParentRoundTrip = true;
|
||||
}
|
||||
return decoded;
|
||||
},
|
||||
});
|
||||
const intent: ManagedSerialSequenceStartIntent = {
|
||||
...engine.startIntent,
|
||||
sequenceTaskMode: mode,
|
||||
mediaBindings: retained,
|
||||
};
|
||||
const status = document.querySelector("#status")!;
|
||||
function settled(operation: Promise<unknown>) {
|
||||
return operation.then(
|
||||
() => {
|
||||
status.textContent = engine.runner().snapshot().parentState ?? "idle";
|
||||
},
|
||||
(error) => {
|
||||
if (lastFailure === null) recordFailure(error);
|
||||
status.textContent = "failed";
|
||||
},
|
||||
);
|
||||
}
|
||||
document.querySelector("#generate")!.addEventListener("click", () => {
|
||||
stage = "runner";
|
||||
void settled(engine.runner().start(intent));
|
||||
});
|
||||
document.querySelector("#terminal")!.addEventListener("click", () => {
|
||||
stage = "runner";
|
||||
void settled(engine.sendTerminalPair(syntheticPromptUuid(200 + queues)));
|
||||
});
|
||||
document.querySelector("#change")!.addEventListener("click", () => {
|
||||
changed = true;
|
||||
});
|
||||
export function snapshot() {
|
||||
return {
|
||||
queues,
|
||||
writes,
|
||||
observations,
|
||||
reads,
|
||||
starts,
|
||||
lastFailure,
|
||||
failureStage,
|
||||
failureName,
|
||||
childModes: [...childModes],
|
||||
bindCounts: [...bindCounts],
|
||||
uniqueReceiptCount: new Set(observedReceiptHandles).size,
|
||||
queuedGuideIndices: structuredClone(queuedGuideIndices),
|
||||
actions: engine.snapshot().actions,
|
||||
runner: engine.runner().snapshot(),
|
||||
};
|
||||
}
|
||||
declare global {
|
||||
interface Window {
|
||||
h3FrameSequence: { snapshot: typeof snapshot };
|
||||
}
|
||||
}
|
||||
window.h3FrameSequence = { snapshot };
|
||||
@@ -0,0 +1,65 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Host appearance compatibility harness</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
#surface {
|
||||
position: relative;
|
||||
margin-left: 58px;
|
||||
width: 1000px;
|
||||
height: 600px;
|
||||
}
|
||||
#panel {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 1100px;
|
||||
}
|
||||
#canvas {
|
||||
position: absolute;
|
||||
left: 234px;
|
||||
width: 478px;
|
||||
height: 500px;
|
||||
}
|
||||
#opposite {
|
||||
position: absolute;
|
||||
left: 712px;
|
||||
width: 288px;
|
||||
height: 500px;
|
||||
}
|
||||
#surface.continuous {
|
||||
display: flex;
|
||||
margin-left: 56px;
|
||||
width: calc(100% - 56px);
|
||||
overflow: hidden;
|
||||
}
|
||||
.continuous #panel {
|
||||
position: relative;
|
||||
flex: 0 0 233px;
|
||||
width: 233px;
|
||||
min-width: 0;
|
||||
}
|
||||
.continuous #main {
|
||||
flex: 1 1 0%;
|
||||
min-width: 0;
|
||||
}
|
||||
.continuous #canvas {
|
||||
position: relative;
|
||||
left: 8px;
|
||||
width: max(0px, calc(100% - 8px));
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="surface">
|
||||
<div id="panel" class="side-bar-panel"><div id="root"></div></div>
|
||||
<div id="canvas" class="graph-canvas-panel"></div>
|
||||
<div id="opposite" class="side-bar-panel"></div>
|
||||
</div>
|
||||
<script type="module" src="/hostAppearance.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,39 @@
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { H3Sidebar } from "../src/components/H3Sidebar";
|
||||
import { createSidebarWidthController } from "../src/host/sidebarWidth";
|
||||
import { initialShellState } from "../src/state/shellState";
|
||||
import "../src/styles/tokens.css";
|
||||
|
||||
const query = new URLSearchParams(location.search);
|
||||
if (query.get("host") !== "none") document.body.classList.add("litegraph");
|
||||
if (query.get("darkClass") === "1")
|
||||
document.documentElement.classList.add("dark-theme");
|
||||
document.documentElement.style.colorScheme = query.get("scheme") ?? "";
|
||||
const surface = document.getElementById("surface")!;
|
||||
if (query.get("shape") === "prime") {
|
||||
surface.className = "p-splitter";
|
||||
surface.dataset.pcName = "splitter";
|
||||
}
|
||||
if (query.get("shape") === "unknown") {
|
||||
document.getElementById("canvas")!.remove();
|
||||
document.getElementById("opposite")!.remove();
|
||||
surface.style.width = "620px";
|
||||
}
|
||||
if (query.get("layout") === "continuous") {
|
||||
surface.classList.add("continuous");
|
||||
const main = document.createElement("div");
|
||||
main.id = "main";
|
||||
main.append(document.getElementById("canvas")!);
|
||||
document.getElementById("opposite")!.remove();
|
||||
surface.append(main);
|
||||
}
|
||||
const mount = document.getElementById("root")!;
|
||||
const root = createRoot(mount);
|
||||
root.render(<H3Sidebar state={initialShellState} locale="en" />);
|
||||
const disposeWidth = createSidebarWidthController(mount);
|
||||
Object.assign(window, {
|
||||
disposeAppearance() {
|
||||
root.unmount();
|
||||
disposeWidth();
|
||||
},
|
||||
});
|
||||
@@ -1,6 +1,37 @@
|
||||
import { app as host } from "../tests/fixtures/entryHostModules";
|
||||
import {
|
||||
app as host,
|
||||
fixtureModalStore,
|
||||
setFixtureModalKeyboardShape,
|
||||
} from "../tests/fixtures/entryHostModules";
|
||||
import type { ModalKeyboardHostShape } from "../tests/support/hostSeamTestDouble";
|
||||
export { app, api } from "../tests/fixtures/entryHostModules";
|
||||
|
||||
let predicateShape: ModalKeyboardHostShape = "data";
|
||||
export function configureHostModalPredicate(shape: ModalKeyboardHostShape) {
|
||||
predicateShape = shape;
|
||||
setFixtureModalKeyboardShape(shape);
|
||||
}
|
||||
|
||||
export function hostModalPredicateActive(): boolean {
|
||||
const predicate =
|
||||
predicateShape === "accessor"
|
||||
? fixtureModalStore.predicate
|
||||
: (Reflect.get(host.constructor, "maskeditor_is_opended") as
|
||||
(() => unknown) | null | undefined);
|
||||
return Boolean(predicate?.call(host.constructor));
|
||||
}
|
||||
|
||||
/** The aria-modal branch of both supported hosts' modalUtil.isModalOpen. */
|
||||
export function hostAriaModalOpen(): boolean {
|
||||
return Array.from(
|
||||
document.querySelectorAll('[role="dialog"][aria-modal="true"]'),
|
||||
).some(
|
||||
(element) =>
|
||||
element.closest('[hidden], [aria-hidden="true"]') === null &&
|
||||
element.checkVisibility({ visibilityProperty: true }),
|
||||
);
|
||||
}
|
||||
|
||||
export type HostKeyWitness = {
|
||||
undoCapture: number;
|
||||
undoActions: number;
|
||||
@@ -18,8 +49,8 @@ export function installHostCapture(
|
||||
canvasKeyups: 0,
|
||||
ghostActions: 0,
|
||||
};
|
||||
// Source-compatible older change-tracker filter; this hermetic mirror is not a native
|
||||
// old-frontend installation. Counts contain no graph, prompt or node payload.
|
||||
// Source-compatible constructor/store readers, plus their shared DOM containment.
|
||||
// This hermetic mirror is not an installed frontend; retain only action counts.
|
||||
window.addEventListener(
|
||||
"keydown",
|
||||
(event) => {
|
||||
@@ -30,17 +61,14 @@ export function installHostCapture(
|
||||
)
|
||||
return;
|
||||
witness.undoCapture += 1;
|
||||
const predicate = Reflect.get(
|
||||
host.constructor,
|
||||
"maskeditor_is_opended",
|
||||
) as (() => boolean) | null;
|
||||
if (predicate?.call(host.constructor)) return;
|
||||
if (hostModalPredicateActive()) return;
|
||||
if (
|
||||
!changeMode &&
|
||||
(event.target instanceof HTMLInputElement ||
|
||||
event.target instanceof HTMLTextAreaElement)
|
||||
)
|
||||
return;
|
||||
if (hostAriaModalOpen()) return;
|
||||
witness.undoActions += 1;
|
||||
},
|
||||
true,
|
||||
|
||||
@@ -1140,7 +1140,7 @@ function ConnectGuidanceHarness() {
|
||||
onChange={(event) => setLocale(event.target.value as Locale)}
|
||||
>
|
||||
<option value="en">English</option>
|
||||
<option value="zh-TW">繁體中文</option>
|
||||
<option value="zh-TW">正體中文</option>
|
||||
<option value="zh-CN">简体中文</option>
|
||||
</select>
|
||||
</label>
|
||||
@@ -1900,7 +1900,7 @@ function ProductionHarness() {
|
||||
onChange={(event) => setLocale(event.target.value as Locale)}
|
||||
>
|
||||
<option value="en">English</option>
|
||||
<option value="zh-TW">繁體中文</option>
|
||||
<option value="zh-TW">正體中文</option>
|
||||
<option value="zh-CN">简体中文</option>
|
||||
</select>
|
||||
</label>
|
||||
@@ -2528,7 +2528,7 @@ function Harness() {
|
||||
onChange={(event) => setLocale(event.target.value as Locale)}
|
||||
>
|
||||
<option value="en">English</option>
|
||||
<option value="zh-TW">繁體中文</option>
|
||||
<option value="zh-TW">正體中文</option>
|
||||
<option value="zh-CN">简体中文</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
@@ -14,6 +14,10 @@ import {
|
||||
type ManagedSerialSequenceStartIntent,
|
||||
} from "../src/host/managedSequence";
|
||||
import type { SequenceCoordinatorResult } from "../src/host/sequenceCoordinator";
|
||||
import type {
|
||||
ManagedSerialAppModeStart,
|
||||
ManagedSerialResolveChild,
|
||||
} from "../src/host/managedSequenceRunnerContract";
|
||||
import {
|
||||
ManagedSequenceClientError,
|
||||
decodeManagedSequenceProjection,
|
||||
@@ -60,6 +64,9 @@ export function createManagedSequenceHarnessEngine(
|
||||
options: {
|
||||
/** The owned projection each child writes, as the page observes it on its own canvas. */
|
||||
ownedProjectionFingerprint?: string;
|
||||
workflowAuthority?: object;
|
||||
startChild?: ManagedSerialAppModeStart;
|
||||
resolveChild?: ManagedSerialResolveChild;
|
||||
} = {},
|
||||
) {
|
||||
const ownedProjection =
|
||||
@@ -108,6 +115,10 @@ export function createManagedSequenceHarnessEngine(
|
||||
revision = 1;
|
||||
return mutation("active");
|
||||
}
|
||||
if (action === "fail_prepared_child") {
|
||||
revision += 1;
|
||||
return mutation("paused_failure");
|
||||
}
|
||||
if (action === "prepare_sequence_child") {
|
||||
activeSegment = payload.segment_id as string;
|
||||
revision += 1;
|
||||
@@ -299,7 +310,7 @@ export function createManagedSequenceHarnessEngine(
|
||||
},
|
||||
};
|
||||
|
||||
const workflowAuthority = {};
|
||||
const workflowAuthority = options.workflowAuthority ?? {};
|
||||
const reattachStore = createManagedSequenceReattachStore(
|
||||
memoryStorage(),
|
||||
() => 1_000,
|
||||
@@ -393,6 +404,12 @@ export function createManagedSequenceHarnessEngine(
|
||||
index === 0 ? fingerprint("0") : ownedProjection,
|
||||
};
|
||||
},
|
||||
...(options.startChild === undefined
|
||||
? {}
|
||||
: { startChild: options.startChild }),
|
||||
...(options.resolveChild === undefined
|
||||
? {}
|
||||
: { resolveChild: options.resolveChild }),
|
||||
});
|
||||
|
||||
let runner = createRunner();
|
||||
|
||||
@@ -15,7 +15,10 @@ import {
|
||||
import type { AuthoringMediaDecorationLeaseClient } from "../src/host/authoringMediaSourceLease";
|
||||
import { defaultDigest } from "../src/host/authoringMediaLeaseTransport";
|
||||
import type { AuthoringMediaVideoSourceContext } from "../src/runtime/authoringDecorationLeaseRequest";
|
||||
import type { MediaTransportOpen } from "../src/runtime/editorRuntime";
|
||||
import {
|
||||
NATIVE_MEDIA_OPERATION_DEADLINE_MS,
|
||||
type MediaTransportOpen,
|
||||
} from "../src/runtime/editorRuntime";
|
||||
import { validatePublicAssetManifest } from "../src/runtime/publicAssetManifest";
|
||||
|
||||
const geometry = (width: number, height: number): AuthoringMediaGeometry => ({
|
||||
@@ -36,22 +39,23 @@ const geometry = (width: number, height: number): AuthoringMediaGeometry => ({
|
||||
// duplicates the primary's), each with its own element and its own clock, so the asset-keyed
|
||||
// entry is only ever the most recent lease; a journey asking which source time a *clip* presents
|
||||
// reads the clip-keyed entry.
|
||||
// `sourceHandoverReadyStates` records each source element's `readyState` at the moment it is
|
||||
// handed to the runtime, so a journey can prove the hand-over precondition below.
|
||||
declare global {
|
||||
interface Window {
|
||||
__nleMediaDebug?: {
|
||||
videoElementsByAsset: Map<string, HTMLVideoElement>;
|
||||
videoElementsByClip: Map<string, HTMLVideoElement>;
|
||||
sourceHandoverReadyStates: number[];
|
||||
};
|
||||
}
|
||||
}
|
||||
function debugRegistry(): {
|
||||
videoElementsByAsset: Map<string, HTMLVideoElement>;
|
||||
videoElementsByClip: Map<string, HTMLVideoElement>;
|
||||
} {
|
||||
function debugRegistry(): NonNullable<Window["__nleMediaDebug"]> {
|
||||
if (window.__nleMediaDebug === undefined) {
|
||||
window.__nleMediaDebug = {
|
||||
videoElementsByAsset: new Map(),
|
||||
videoElementsByClip: new Map(),
|
||||
sourceHandoverReadyStates: [],
|
||||
};
|
||||
}
|
||||
return window.__nleMediaDebug;
|
||||
@@ -353,7 +357,9 @@ async function bytes(
|
||||
const response = await fetch(`/nle-media/${member}${query}`, { signal });
|
||||
if (!response.ok) throw new Error("synthetic_media_unavailable");
|
||||
const blob = await response.blob();
|
||||
if (blob.size > 1024 * 1024) throw new Error("synthetic_media_bound");
|
||||
// Pinned CJK SC Bold is 8,543,168 bytes; other synthetic members keep their 1 MiB cap.
|
||||
if (blob.size > (member === "font" ? 12 : 1) * 1024 * 1024)
|
||||
throw new Error("synthetic_media_bound");
|
||||
const corpus =
|
||||
assetId !== undefined &&
|
||||
response.headers.get(CORPUS_MEDIA_HEADER) === assetId;
|
||||
@@ -390,29 +396,58 @@ async function still(
|
||||
return { blob, corpus: false };
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits until a source element has metadata, the state the product's own source owner hands over
|
||||
* (`waitForVideoMetadata` in `src/host/authoringMediaSourceLease.ts`), with the same bound.
|
||||
*
|
||||
* IMPORTANT: every source video, generic or corpus, must be handed over only after this wait.
|
||||
* The runtime assigns `currentTime` at once. At HAVE_NOTHING that assignment only records a start
|
||||
* position: no seek, `seeked` or `timeupdate` follows, so the open depends on a single first-frame
|
||||
* frame callback. A busy browser can lose that callback, and the native 3 s presentation deadline
|
||||
* then latches the monitor as "source unavailable" with Play disabled (about 1 open in 30-60 with
|
||||
* the browser held to two CPUs). Returning generic media before metadata, as this harness once
|
||||
* did, is the divergence to avoid.
|
||||
*/
|
||||
async function sourceMetadata(
|
||||
element: HTMLVideoElement,
|
||||
signal: AbortSignal,
|
||||
): Promise<void> {
|
||||
if (signal.aborted) throw new Error("cancelled");
|
||||
if (element.readyState >= 1) return;
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
let timer: ReturnType<typeof setTimeout> | undefined;
|
||||
const finish = (error?: Error) => {
|
||||
element.removeEventListener("loadedmetadata", loaded);
|
||||
element.removeEventListener("error", undecodable);
|
||||
element.removeEventListener("abort", undecodable);
|
||||
signal.removeEventListener("abort", cancelled);
|
||||
clearTimeout(timer);
|
||||
if (error === undefined) resolve();
|
||||
else reject(error);
|
||||
};
|
||||
const loaded = () => finish();
|
||||
const undecodable = () => finish(new Error("synthetic_media_undecodable"));
|
||||
const cancelled = () => finish(new Error("cancelled"));
|
||||
element.addEventListener("loadedmetadata", loaded, { once: true });
|
||||
element.addEventListener("error", undecodable, { once: true });
|
||||
element.addEventListener("abort", undecodable, { once: true });
|
||||
signal.addEventListener("abort", cancelled, { once: true });
|
||||
timer = setTimeout(undecodable, NATIVE_MEDIA_OPERATION_DEADLINE_MS);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The served corpus source's true pixel size for `geometry.sourceWidth`/`sourceHeight`, measured
|
||||
* from the decoded media itself (a transform or crop row's expectation is derived from
|
||||
* `semantic_conformance_media.SOURCE_WIDTH`/`SOURCE_HEIGHT` and the clip's own transform, so the
|
||||
* runtime must present the real source size). Only a response the corpus route marked is
|
||||
* measured; an unmarked response keeps the generic placeholder geometry every other journey
|
||||
* already relies on, whatever asset id it was requested under.
|
||||
* already relies on, whatever asset id it was requested under. Call it after `sourceMetadata`.
|
||||
*/
|
||||
async function measuredVideoGeometry(
|
||||
element: HTMLVideoElement,
|
||||
): Promise<{ width: number; height: number }> {
|
||||
if (element.readyState < 1) {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
element.addEventListener("loadedmetadata", () => resolve(), {
|
||||
once: true,
|
||||
});
|
||||
element.addEventListener(
|
||||
"error",
|
||||
() => reject(new Error("synthetic_media_undecodable")),
|
||||
{ once: true },
|
||||
);
|
||||
});
|
||||
}
|
||||
function measuredVideoGeometry(element: HTMLVideoElement): {
|
||||
width: number;
|
||||
height: number;
|
||||
} {
|
||||
return { width: element.videoWidth, height: element.videoHeight };
|
||||
}
|
||||
|
||||
@@ -562,8 +597,15 @@ const untrackedMediaClient: AuthoringMediaDecorationLeaseClient = {
|
||||
videoElements--;
|
||||
dropRetention();
|
||||
}, "source");
|
||||
try {
|
||||
await sourceMetadata(element, request.signal);
|
||||
} catch (error) {
|
||||
release();
|
||||
throw error;
|
||||
}
|
||||
registry.sourceHandoverReadyStates.push(element.readyState);
|
||||
const { width, height } = corpus
|
||||
? await measuredVideoGeometry(element)
|
||||
? measuredVideoGeometry(element)
|
||||
: { width: 320, height: 180 };
|
||||
return {
|
||||
element,
|
||||
|
||||
@@ -4,11 +4,19 @@ import {
|
||||
initialAppModeDraft,
|
||||
type AppModeDraft,
|
||||
} from "../src/components/H3Sidebar";
|
||||
import { SUPPORTED_LOCALES, type Locale } from "../src/i18n/catalog";
|
||||
import {
|
||||
sidebarCopy,
|
||||
SUPPORTED_LOCALES,
|
||||
type Locale,
|
||||
} from "../src/i18n/catalog";
|
||||
import { ImageCropAction } from "../src/components/ImageCropAction";
|
||||
import { initialShellState } from "../src/state/shellState";
|
||||
import { createImageCropSources } from "../src/host/imageCropSource";
|
||||
import { seamReady } from "../src/host/hostSeams";
|
||||
import { fixtureBackedAppModeApi } from "../tests/support/hostSeamTestDouble";
|
||||
import { acquireModalKeyboardGuard } from "../src/host/modalKeyboardGuard";
|
||||
import { acquireCanvasKeyboardGuard } from "../src/host/canvasKeyboardGuard";
|
||||
import { app as keyboardHost } from "./hostKeyboard";
|
||||
|
||||
const mediaSources = (["image", "video", "audio"] as const).flatMap(
|
||||
(kind, group) =>
|
||||
@@ -21,6 +29,7 @@ const mediaSources = (["image", "video", "audio"] as const).flatMap(
|
||||
);
|
||||
const empty: AppModeDraft = { ...initialAppModeDraft, taskMode: "ref2va" };
|
||||
export function ReferencePickerHarness({ crop = false }: { crop?: boolean }) {
|
||||
const sample = new URLSearchParams(location.search).get("crop-description");
|
||||
const [locale, setLocale] = useState<Locale>("en");
|
||||
const [draft, setDraft] = useState(empty);
|
||||
const [starts, setStarts] = useState(0);
|
||||
@@ -105,55 +114,84 @@ export function ReferencePickerHarness({ crop = false }: { crop?: boolean }) {
|
||||
</>
|
||||
) : null}
|
||||
<div id="reference-picker-sidebar" style={{ width: "100%" }}>
|
||||
<H3Sidebar
|
||||
locale={locale}
|
||||
state={initialShellState}
|
||||
appModeDraft={draft}
|
||||
onAppModeDraftChange={setDraft}
|
||||
appMode={{
|
||||
...(crop
|
||||
? {
|
||||
imageCrop: {
|
||||
available: cropAvailable,
|
||||
actions: cropSources,
|
||||
acquireKeyboardGuard: () => {
|
||||
setLeases((n) => n + 1);
|
||||
let released = false;
|
||||
return seamReady({
|
||||
release() {
|
||||
if (!released) {
|
||||
released = true;
|
||||
setLeases((n) => n - 1);
|
||||
}
|
||||
},
|
||||
});
|
||||
{crop && (sample === "choose" || sample === "useExisting") ? (
|
||||
<section className="h3c" data-crop-description-sample>
|
||||
<div className="h3-frame-source">
|
||||
<span>{sidebarCopy(locale).firstFrameSource}</span>
|
||||
<ImageCropAction
|
||||
id="sample"
|
||||
actions={{
|
||||
crops: {},
|
||||
label: sidebarCopy(locale).crop.action,
|
||||
reason: sidebarCopy(locale).crop[sample],
|
||||
open() {},
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
) : (
|
||||
<H3Sidebar
|
||||
locale={locale}
|
||||
state={initialShellState}
|
||||
appModeDraft={draft}
|
||||
onAppModeDraftChange={setDraft}
|
||||
appMode={{
|
||||
...(crop
|
||||
? {
|
||||
imageCrop: {
|
||||
available: cropAvailable,
|
||||
actions: cropSources,
|
||||
acquireKeyboardGuard: (onInvalidated) => {
|
||||
const modal = acquireModalKeyboardGuard(keyboardHost);
|
||||
if (modal.status !== "ready") return modal;
|
||||
const canvas = acquireCanvasKeyboardGuard(
|
||||
keyboardHost,
|
||||
onInvalidated,
|
||||
);
|
||||
if (canvas.status !== "ready") {
|
||||
modal.value.release();
|
||||
return canvas;
|
||||
}
|
||||
setLeases((n) => n + 1);
|
||||
let released = false;
|
||||
return seamReady({
|
||||
release() {
|
||||
if (!released) {
|
||||
released = true;
|
||||
canvas.value.release();
|
||||
modal.value.release();
|
||||
setLeases((n) => n - 1);
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
capability: { status: "ready" },
|
||||
mediaSources,
|
||||
imageSources: mediaSources.filter(
|
||||
(source) => source.kind === "image",
|
||||
),
|
||||
durationResolution: {
|
||||
status: "resolved",
|
||||
resolution: {
|
||||
schema: "h3.context.duration_resolution.v1",
|
||||
requested_seconds: 5,
|
||||
requested_milliseconds: 5000,
|
||||
effective_milliseconds: 5167,
|
||||
frame_count: 124,
|
||||
snapped: true,
|
||||
}
|
||||
: {}),
|
||||
capability: { status: "ready" },
|
||||
mediaSources,
|
||||
imageSources: mediaSources.filter(
|
||||
(source) => source.kind === "image",
|
||||
),
|
||||
durationResolution: {
|
||||
status: "resolved",
|
||||
resolution: {
|
||||
schema: "h3.context.duration_resolution.v1",
|
||||
requested_seconds: 5,
|
||||
requested_milliseconds: 5000,
|
||||
effective_milliseconds: 5167,
|
||||
frame_count: 124,
|
||||
snapped: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
onStart: (inputs) => {
|
||||
setPayload(JSON.stringify(inputs));
|
||||
setStarts((value) => value + 1);
|
||||
},
|
||||
onCancel: () => {},
|
||||
}}
|
||||
/>
|
||||
onStart: (inputs) => {
|
||||
setPayload(JSON.stringify(inputs));
|
||||
setStarts((value) => value + 1);
|
||||
},
|
||||
onCancel: () => {},
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@comfyui-h3-context/frontend",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.6",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"packageManager": "pnpm@11.3.0",
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { searchForWorkspaceRoot } from "vite";
|
||||
|
||||
export function presetFontAllow(root: string): string[] {
|
||||
// IMPORTANT: retain Vite's default boundary and add files, not the font/repository
|
||||
// directory; broadening this to a directory would expose unrelated local records.
|
||||
return [
|
||||
searchForWorkspaceRoot(root),
|
||||
fileURLToPath(
|
||||
new URL(
|
||||
"../comfyui_h3_context/fonts/NotoSans-Regular.ttf",
|
||||
import.meta.url,
|
||||
),
|
||||
),
|
||||
fileURLToPath(
|
||||
new URL("../comfyui_h3_context/fonts/NotoSans-Bold.ttf", import.meta.url),
|
||||
),
|
||||
];
|
||||
}
|
||||
@@ -13,7 +13,10 @@ const e2eBaseUrl = `http://127.0.0.1:${e2ePort}`;
|
||||
export default defineConfig({
|
||||
testDir: "tests/e2e",
|
||||
testMatch: [
|
||||
"journeys/hostAppearance.spec.ts",
|
||||
"journeys/harnessBoot.spec.ts",
|
||||
// The closed open diagnostic a failed integrated-shell open attaches for the hermetic CI.
|
||||
"journeys/integratedShellDiagnostics.spec.ts",
|
||||
"journeys/nleWorkspace.spec.ts",
|
||||
// empty-capable V2 authoring, content extent, and the V1 render boundary.
|
||||
"journeys/m25_57ContentExtent.spec.ts",
|
||||
@@ -28,6 +31,8 @@ export default defineConfig({
|
||||
"journeys/timelineButtonShortcuts.spec.ts",
|
||||
"journeys/editorKeyContainment.spec.ts",
|
||||
"journeys/titleInsertion.spec.ts",
|
||||
"journeys/titleStylePresets.spec.ts",
|
||||
"journeys/cjkTitleFonts.spec.ts",
|
||||
"journeys/titleDecorations.spec.ts",
|
||||
"journeys/wipeTransitions.spec.ts",
|
||||
"journeys/liveBinDrag.spec.ts",
|
||||
@@ -125,6 +130,7 @@ export default defineConfig({
|
||||
"journeys/duration.spec.ts",
|
||||
"journeys/managedLifecycle.spec.ts",
|
||||
"journeys/managedSequence.spec.ts",
|
||||
"journeys/frameSequence.spec.ts",
|
||||
"journeys/managedQualification.spec.ts",
|
||||
"journeys/hostAvailability.spec.ts",
|
||||
"journeys/managedDiagnostics.spec.ts",
|
||||
|
||||
@@ -95,7 +95,14 @@ function OutputBody({
|
||||
<h3>{text.title}</h3>
|
||||
<p role="status">{job ? text.phases[job.phase] : text.empty}</p>
|
||||
{old && <p className="h3a-output-warning">{text.old}</p>}
|
||||
{state.error && <p role="alert">{text.error}</p>}
|
||||
{state.error && (
|
||||
<p role="alert">{state.pathTooDeep ? text.pathTooDeep : text.error}</p>
|
||||
)}
|
||||
{!state.error &&
|
||||
job?.phase === "failed" &&
|
||||
job.failure === "path_too_deep" && (
|
||||
<p role="alert">{text.pathTooDeep}</p>
|
||||
)}
|
||||
{job?.phase === "failed" && job.failure === "font_changed" && (
|
||||
<p role="alert">{text.fontUnavailable}</p>
|
||||
)}
|
||||
|
||||
@@ -8,7 +8,14 @@ import {
|
||||
PreparedSourceGuidance,
|
||||
} from "./CanvasSourceGuidance";
|
||||
import { referenceCapacity } from "../host/referenceSelection";
|
||||
import { useEffect, useRef, useState, type KeyboardEvent } from "react";
|
||||
import {
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useRef,
|
||||
useState,
|
||||
type KeyboardEvent,
|
||||
} from "react";
|
||||
import { createHostThemeController } from "../host/hostTheme";
|
||||
|
||||
import type {
|
||||
AppModeAdmission,
|
||||
@@ -1075,7 +1082,9 @@ function AppModeEntry({
|
||||
if (activeStage === "media") onChooseNative?.();
|
||||
else if (activeStage === "understand") setActiveStage("audit");
|
||||
else if (activeStage === "audit") setActiveStage("execute");
|
||||
else submit();
|
||||
// IMPORTANT: Execute must explicitly adopt an admitted existing canvas;
|
||||
// omitting the route makes the controller correctly refuse it as dirty_graph.
|
||||
else submit(useExistingAction ? { useExisting: true } : undefined);
|
||||
};
|
||||
return (
|
||||
<div className="h3-app-stage-panel-content">
|
||||
@@ -1352,6 +1361,11 @@ export function H3Sidebar({
|
||||
}) {
|
||||
const text = sidebarCopy(locale);
|
||||
const pages = pageCopy(locale);
|
||||
const themeRoot = useRef<HTMLElement>(null);
|
||||
useLayoutEffect(() => {
|
||||
if (themeRoot.current !== null)
|
||||
return createHostThemeController(themeRoot.current);
|
||||
}, []);
|
||||
const [diagnosticsStatus, setDiagnosticsStatus] = useState<
|
||||
"copied" | "fallback" | undefined
|
||||
>();
|
||||
@@ -1533,6 +1547,7 @@ export function H3Sidebar({
|
||||
return (
|
||||
<section
|
||||
className="h3c"
|
||||
ref={themeRoot}
|
||||
// the panel declares its own language. The CJK type variant keys
|
||||
// on `:lang(zh)`, and a screen reader needs the same signal to pick the
|
||||
// right voice -- without this attribute both would silently do nothing.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import type { SeamResult } from "../host/hostSeams";
|
||||
import { createHostThemeController } from "../host/hostTheme";
|
||||
import type {
|
||||
CropSourceImage,
|
||||
ImageCropSourceActions,
|
||||
@@ -67,6 +68,11 @@ export function ImageCropDialog({
|
||||
const titleId = useId();
|
||||
const helpId = useId();
|
||||
const dialog = useRef<HTMLDivElement>(null);
|
||||
const themeRoot = useRef<HTMLDivElement>(null);
|
||||
useLayoutEffect(() => {
|
||||
if (themeRoot.current !== null)
|
||||
return createHostThemeController(themeRoot.current);
|
||||
}, []);
|
||||
const imageBox = useRef<HTMLDivElement>(null);
|
||||
const release = useRef<() => void>(() => {});
|
||||
const [source, setSource] = useState<CropSourceImage>();
|
||||
@@ -153,7 +159,7 @@ export function ImageCropDialog({
|
||||
};
|
||||
return createPortal(
|
||||
<div data-h3-context-mount="" className="h3-crop-portal">
|
||||
<div className="h3c h3-crop-backdrop">
|
||||
<div className="h3c h3-crop-backdrop" ref={themeRoot}>
|
||||
<div
|
||||
ref={dialog}
|
||||
className="h3-crop-dialog"
|
||||
|
||||
@@ -29,7 +29,7 @@ const copy = {
|
||||
language: "Language",
|
||||
auto: "Automatic (ComfyUI locale)",
|
||||
en: "English",
|
||||
"zh-TW": "繁體中文",
|
||||
"zh-TW": "正體中文",
|
||||
"zh-CN": "简体中文",
|
||||
pending: "Saving language preference.",
|
||||
invalid: "The stored language value is invalid.",
|
||||
@@ -43,7 +43,7 @@ const copy = {
|
||||
language: "語言",
|
||||
auto: "自動(ComfyUI 語系)",
|
||||
en: "English",
|
||||
"zh-TW": "繁體中文",
|
||||
"zh-TW": "正體中文",
|
||||
"zh-CN": "简体中文",
|
||||
pending: "正在儲存語言偏好。",
|
||||
invalid: "已儲存的語言值無效。",
|
||||
@@ -57,7 +57,7 @@ const copy = {
|
||||
language: "语言",
|
||||
auto: "自动(ComfyUI 语言)",
|
||||
en: "English",
|
||||
"zh-TW": "繁體中文",
|
||||
"zh-TW": "正體中文",
|
||||
"zh-CN": "简体中文",
|
||||
pending: "正在保存语言偏好。",
|
||||
invalid: "已保存的语言值无效。",
|
||||
|
||||
@@ -11,6 +11,7 @@ type Copy = {
|
||||
old: string;
|
||||
empty: string;
|
||||
error: string;
|
||||
pathTooDeep: string;
|
||||
fontUnavailable: string;
|
||||
refresh: string;
|
||||
loading: string;
|
||||
@@ -41,6 +42,8 @@ export const outputCopy: Record<Locale, Copy> = {
|
||||
"Output status is unavailable. Refresh before accessing this output.",
|
||||
fontUnavailable:
|
||||
"The title font changed or cannot render some characters. Edit the title text or style before rendering again.",
|
||||
pathTooDeep:
|
||||
"The ComfyUI folder path is too deep for rendering on Windows. Move ComfyUI to a shorter folder.",
|
||||
refresh: "Refresh status",
|
||||
loading: "Loading preview",
|
||||
previewError: "Preview unavailable. The original remains separate.",
|
||||
@@ -78,6 +81,8 @@ export const outputCopy: Record<Locale, Copy> = {
|
||||
error: "無法取得輸出狀態。請重新整理後再存取。",
|
||||
fontUnavailable:
|
||||
"標題字型已變更,或無法顯示部分字元。請編輯標題文字或樣式後再算繪。",
|
||||
pathTooDeep:
|
||||
"ComfyUI 資料夾路徑太深,無法在 Windows 算繪。請將 ComfyUI 移至較短的資料夾路徑。",
|
||||
refresh: "重新整理狀態",
|
||||
loading: "正在載入預覽",
|
||||
previewError: "預覽不可用;原檔仍為獨立輸出。",
|
||||
@@ -115,6 +120,8 @@ export const outputCopy: Record<Locale, Copy> = {
|
||||
error: "无法获取输出状态。请刷新后再访问。",
|
||||
fontUnavailable:
|
||||
"标题字体已更改,或无法显示部分字符。请编辑标题文字或样式后再渲染。",
|
||||
pathTooDeep:
|
||||
"ComfyUI 文件夹路径过深,无法在 Windows 渲染。请将 ComfyUI 移至较短的文件夹路径。",
|
||||
refresh: "刷新状态",
|
||||
loading: "正在加载预览",
|
||||
previewError: "预览不可用;原文件仍为独立输出。",
|
||||
|
||||
@@ -164,13 +164,35 @@ export function NleIconGroup({
|
||||
clipTop = Math.max(node.getBoundingClientRect().top, 0);
|
||||
break;
|
||||
}
|
||||
let clipLeft = 0;
|
||||
let clipRight = document.documentElement.clientWidth;
|
||||
for (let node = group.parentElement; node; node = node.parentElement) {
|
||||
if (getComputedStyle(node).overflowX !== "visible") {
|
||||
const box = node.getBoundingClientRect();
|
||||
clipLeft = Math.max(clipLeft, box.left + node.clientLeft);
|
||||
clipRight = Math.min(
|
||||
clipRight,
|
||||
box.left + node.clientLeft + node.clientWidth,
|
||||
);
|
||||
}
|
||||
}
|
||||
// IMPORTANT: a one-action group is only 44px wide. Keep description width independent of
|
||||
// that group, then anchor inside every horizontal clip; inheriting its width splits words.
|
||||
tip.style.maxInlineSize = `min(20rem, ${Math.max(0, clipRight - clipLeft)}px)`;
|
||||
const groupBox = group.getBoundingClientRect();
|
||||
const width = tip.getBoundingClientRect().width;
|
||||
const start = groupBox.left;
|
||||
const end = groupBox.right - width;
|
||||
const left =
|
||||
start + width <= clipRight
|
||||
? Math.max(start, clipLeft)
|
||||
: Math.max(clipLeft, Math.min(end, clipRight - width));
|
||||
tip.style.left = `${left - groupBox.left}px`;
|
||||
// IMPORTANT: placement is presentation-only. Publishing it through React adds a second root
|
||||
// commit to every focused edit action and breaks the <=4 accepted-edit budget; mutate the
|
||||
// already-owned tooltip node after layout instead.
|
||||
tip.dataset.placement =
|
||||
group.getBoundingClientRect().top - clipTop < tip.offsetHeight + 6
|
||||
? "below"
|
||||
: "above";
|
||||
groupBox.top - clipTop < tip.offsetHeight + 6 ? "below" : "above";
|
||||
};
|
||||
const open = (tip: NonNullable<Tip>, target: HTMLElement | null) => {
|
||||
if (visibleGroup !== null && visibleGroup !== owner) visibleGroup.dismiss();
|
||||
|
||||
@@ -55,7 +55,9 @@ import {
|
||||
type TransformWire,
|
||||
} from "./nleCommandBuilders";
|
||||
import { fill, nleCopy } from "./nleCopy";
|
||||
import { titleTextCovered } from "./nleTitleCoverage";
|
||||
import { titleTextCovered, titleTextRefusal } from "./nleTitleCoverage";
|
||||
import { applyPreset } from "./nleTextPresets";
|
||||
import { NleTextPresetGrid } from "./NleTextPresetGrid";
|
||||
import { assetDisplayNames, clipDisplayName } from "./nleTimelineSurface";
|
||||
import { NleActionIcon } from "./NleIconActions";
|
||||
import {
|
||||
@@ -2118,6 +2120,35 @@ function ClipPropertyTabs({
|
||||
</PropertyGroup>
|
||||
) : activeTab === "text" && style !== null && acceptedStyle !== null ? (
|
||||
<>
|
||||
<NleTextPresetGrid
|
||||
locale={locale}
|
||||
mode="apply"
|
||||
selected={(preset) =>
|
||||
same(applyPreset(acceptedStyle, preset), acceptedStyle)
|
||||
}
|
||||
refusal={(preset) => {
|
||||
if (busy) return text.assets.titleRefusals.busy;
|
||||
const next = applyPreset(acceptedStyle, preset);
|
||||
return titleTextCovered(textContentOf(clip), next)
|
||||
? undefined
|
||||
: text.assets.titleRefusals[
|
||||
titleTextRefusal(textContentOf(clip), next)
|
||||
];
|
||||
}}
|
||||
onChoose={(preset) => {
|
||||
// Use accepted counterparts, not an unsubmitted size/font draft. Refusals
|
||||
// must preserve that draft and issue no partial style command.
|
||||
const next = applyPreset(acceptedStyle, preset);
|
||||
if (
|
||||
busy ||
|
||||
same(next, acceptedStyle) ||
|
||||
!titleTextCovered(textContentOf(clip), next)
|
||||
)
|
||||
return;
|
||||
setStyle(next);
|
||||
commitTextStyleValue(next);
|
||||
}}
|
||||
/>
|
||||
<PropertyGroup
|
||||
label={copy.groups.textContent}
|
||||
resetLabel={resetLabel(copy.groups.textContent)}
|
||||
@@ -2172,7 +2203,9 @@ function ClipPropertyTabs({
|
||||
{!textValid ? (
|
||||
<p role="alert" className="h3-nle-validation">
|
||||
{textSyntaxValid
|
||||
? text.assets.titleRefusals.font_glyph_unsupported
|
||||
? text.assets.titleRefusals[
|
||||
titleTextRefusal(content, acceptedStyle!)
|
||||
]
|
||||
: copy.invalidText}
|
||||
</p>
|
||||
) : null}
|
||||
@@ -2287,7 +2320,11 @@ function ClipPropertyTabs({
|
||||
</CommitButton>
|
||||
{!textStyleValid ? (
|
||||
<p role="alert" className="h3-nle-validation">
|
||||
{text.assets.titleRefusals.font_glyph_unsupported}
|
||||
{
|
||||
text.assets.titleRefusals[
|
||||
titleTextRefusal(textContentOf(clip), style!)
|
||||
]
|
||||
}
|
||||
</p>
|
||||
) : null}
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
type ReactNode,
|
||||
} from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { createHostThemeController } from "../../host/hostTheme";
|
||||
|
||||
import type { NleCloseReason } from "../../state/nleWorkspaceState";
|
||||
import { saveIndicatorModel } from "../../runtime/nleSaveIndicator";
|
||||
@@ -333,6 +334,7 @@ export function NleOverlay({ binding }: { binding: NleWorkspaceBinding }) {
|
||||
for (const type of ["keydown", "keyup", "keypress"])
|
||||
host.addEventListener(type, contain);
|
||||
document.body.append(host);
|
||||
const disposeTheme = createHostThemeController(host);
|
||||
const topLayer = enterTopLayer(host);
|
||||
attached.current = true;
|
||||
return () => {
|
||||
@@ -345,6 +347,7 @@ export function NleOverlay({ binding }: { binding: NleWorkspaceBinding }) {
|
||||
} catch {
|
||||
// A root already hidden by its removal needs nothing more.
|
||||
}
|
||||
disposeTheme();
|
||||
host.remove();
|
||||
guard.value.release();
|
||||
// IMPORTANT: restore after the release commit has re-enabled the launcher.
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
// accepted action; mount, remount and polling never plan, qualify, queue or assemble.
|
||||
|
||||
import { useState } from "react";
|
||||
import {
|
||||
emptySequenceDiagnostics,
|
||||
sequenceDiagnosticFailure,
|
||||
} from "../../host/managedSequenceDiagnostics";
|
||||
|
||||
import type { ProductionViewState } from "../ProductionWorkbench";
|
||||
import type { AssemblyOutputProfileId } from "../../contracts/productionWorkbenchCodec";
|
||||
@@ -118,8 +122,42 @@ function SequenceSection({
|
||||
const text = nleCopy(locale);
|
||||
const ui = sequence.ui;
|
||||
const pointer = actions.recoveryPointerPresent();
|
||||
const diagnostic = sequence.diagnostics ?? emptySequenceDiagnostics();
|
||||
return (
|
||||
<section aria-label={text.sequence.state[ui]} data-h3-nle-sequence-ui={ui}>
|
||||
<section
|
||||
aria-label={text.sequence.state[ui]}
|
||||
data-h3-nle-sequence-ui={ui}
|
||||
data-h3-nle-parent-state={diagnostic.parentState ?? "null"}
|
||||
data-h3-nle-active-child-ordinal={diagnostic.activeChildOrdinal ?? "null"}
|
||||
data-h3-nle-gate-child-ordinal={diagnostic.gate.childOrdinal ?? "null"}
|
||||
data-h3-nle-gate-artifact-recorded={String(
|
||||
diagnostic.gate.artifactRecorded,
|
||||
)}
|
||||
data-h3-nle-gate-terminal-kind-known={String(
|
||||
diagnostic.gate.terminalKindKnown,
|
||||
)}
|
||||
data-h3-nle-gate-terminal-fingerprint-present={String(
|
||||
diagnostic.gate.terminalFingerprintPresent,
|
||||
)}
|
||||
data-h3-nle-gate-released={String(diagnostic.gate.released)}
|
||||
data-h3-nle-gate-parent-terminal-recorded={String(
|
||||
diagnostic.gate.parentTerminalRecorded,
|
||||
)}
|
||||
data-h3-nle-successor-ordinal={diagnostic.successor.ordinal ?? "null"}
|
||||
data-h3-nle-successor-prepared={String(diagnostic.successor.prepared)}
|
||||
data-h3-nle-failure-code={
|
||||
sequenceDiagnosticFailure(sequence.failure) ?? "null"
|
||||
}
|
||||
data-h3-nle-ui-state={ui}
|
||||
data-h3-nle-failure-origin={diagnostic.failureAttribution.origin}
|
||||
data-h3-nle-failure-boundary={diagnostic.failureAttribution.boundary}
|
||||
data-h3-nle-failure-managed-action={
|
||||
diagnostic.failureAttribution.managedAction
|
||||
}
|
||||
data-h3-nle-failure-http-status-class={
|
||||
diagnostic.failureAttribution.httpStatusClass
|
||||
}
|
||||
>
|
||||
<div className="h3-nle-form">
|
||||
<div className="h3-nle-actions">
|
||||
<span
|
||||
|
||||
@@ -2,7 +2,9 @@ import { useCallback, useId, useState, useSyncExternalStore } from "react";
|
||||
|
||||
import type { AuthoringIntent } from "../../state/authoringViewState";
|
||||
import type { Locale } from "../../i18n/catalog";
|
||||
import { DEFAULT_TITLE_TEXT } from "./nleCommandBuilders";
|
||||
import { DEFAULT_TEXT_STYLE, DEFAULT_TITLE_TEXT } from "./nleCommandBuilders";
|
||||
import { NleTextPresetGrid } from "./NleTextPresetGrid";
|
||||
import { applyPreset, type TextPreset } from "./nleTextPresets";
|
||||
import {
|
||||
planTitleInsertion,
|
||||
type TitleInsertionAuthority,
|
||||
@@ -62,6 +64,17 @@ export function NleTextBin({
|
||||
const decision = decide();
|
||||
if (decision.admitted) void onIntent(decision.intent);
|
||||
};
|
||||
const decidePreset = (preset: TextPreset) =>
|
||||
planTitleInsertion(snapshot, {
|
||||
busy,
|
||||
frame: currentFrame(),
|
||||
fontId,
|
||||
content,
|
||||
style: applyPreset(
|
||||
{ ...DEFAULT_TEXT_STYLE, font_asset_id: fontId },
|
||||
preset,
|
||||
),
|
||||
});
|
||||
|
||||
return (
|
||||
<section className="h3-nle-text-bin">
|
||||
@@ -108,6 +121,20 @@ export function NleTextBin({
|
||||
{refusal}
|
||||
</p>
|
||||
)}
|
||||
<NleTextPresetGrid
|
||||
locale={locale}
|
||||
mode="insert"
|
||||
refusal={(preset) => {
|
||||
const decision = decidePreset(preset);
|
||||
return decision.admitted
|
||||
? undefined
|
||||
: text.titleRefusals[decision.reason];
|
||||
}}
|
||||
onChoose={(preset) => {
|
||||
const decision = decidePreset(preset);
|
||||
if (decision.admitted) void onIntent(decision.intent);
|
||||
}}
|
||||
/>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
import { useCallback, useEffect, useId, useState } from "react";
|
||||
import type { Locale } from "../../i18n/catalog";
|
||||
import { drawText } from "../../runtime/visualCompositor";
|
||||
import { nleCopy, fill } from "./nleCopy";
|
||||
import {
|
||||
getTitlePresetFonts,
|
||||
type PresetFontOwner,
|
||||
} from "./nleTextPresetFonts";
|
||||
import { TEXT_PRESETS, type TextPreset } from "./nleTextPresets";
|
||||
export type NleTextPresetGridProps = Readonly<{
|
||||
locale: Locale;
|
||||
mode: "insert" | "apply";
|
||||
refusal(preset: TextPreset): string | undefined;
|
||||
onChoose(preset: TextPreset): void;
|
||||
selected?(preset: TextPreset): boolean;
|
||||
}>;
|
||||
type Faces = Readonly<Record<400 | 700, PresetFontOwner>>;
|
||||
|
||||
function PresetSample({
|
||||
preset,
|
||||
faces,
|
||||
onFailure,
|
||||
}: {
|
||||
preset: TextPreset;
|
||||
faces: Faces;
|
||||
onFailure(): void;
|
||||
}) {
|
||||
const [canvas, setCanvas] = useState<HTMLCanvasElement | null>(null);
|
||||
useEffect(() => {
|
||||
if (canvas === null) return;
|
||||
try {
|
||||
const context = canvas.getContext("2d");
|
||||
if (context === null) throw new Error("canvas unavailable");
|
||||
const style = preset.style;
|
||||
context.clearRect(0, 0, 256, 96);
|
||||
drawText(
|
||||
context,
|
||||
{
|
||||
clipId: "preset-sample",
|
||||
assetId: null,
|
||||
trackId: "preset-sample",
|
||||
sourceFrame: null,
|
||||
sourcePts: null,
|
||||
transitionElapsedFrames: null,
|
||||
operationIds: [],
|
||||
transform: {},
|
||||
crop: {},
|
||||
opacityBp: 10000,
|
||||
blend: "normal",
|
||||
effect: {},
|
||||
text: {
|
||||
content: "Title",
|
||||
fontAssetId: "h3.font.noto_sans.v1",
|
||||
sizePx: 36,
|
||||
weight: style.weight,
|
||||
style: style.style,
|
||||
align: "center",
|
||||
lineHeightBp: 12000,
|
||||
fillRgba: style.fill_rgba,
|
||||
backgroundRgba: style.background_rgba,
|
||||
...(style.stroke
|
||||
? {
|
||||
stroke: {
|
||||
rgba: style.stroke.rgba,
|
||||
widthPx: style.stroke.width_px,
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
...(style.shadow
|
||||
? {
|
||||
shadow: {
|
||||
rgba: style.shadow.rgba,
|
||||
offsetXPx: style.shadow.offset_x_px,
|
||||
offsetYPx: style.shadow.offset_y_px,
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
...(style.background_padding_px === undefined
|
||||
? {}
|
||||
: { backgroundPaddingPx: style.background_padding_px }),
|
||||
},
|
||||
},
|
||||
{ kind: "font", family: faces[style.weight].family },
|
||||
{
|
||||
nativeCrop: { left: 0, top: 0, width: 256, height: 96 },
|
||||
sourceCrop: { left: 0, top: 0, width: 256, height: 96 },
|
||||
scaledWidth: 256,
|
||||
scaledHeight: 96,
|
||||
angleRadians: 0,
|
||||
centerX: 128,
|
||||
centerY: 48,
|
||||
},
|
||||
256,
|
||||
96,
|
||||
1,
|
||||
);
|
||||
} catch {
|
||||
onFailure();
|
||||
}
|
||||
}, [canvas, preset, faces, onFailure]);
|
||||
return <canvas ref={setCanvas} width={256} height={96} aria-hidden="true" />;
|
||||
}
|
||||
|
||||
export function NleTextPresetGrid({
|
||||
locale,
|
||||
mode,
|
||||
refusal,
|
||||
onChoose,
|
||||
selected,
|
||||
}: NleTextPresetGridProps) {
|
||||
const copy = nleCopy(locale).presets;
|
||||
const prefix = useId();
|
||||
const [cache] = useState(getTitlePresetFonts);
|
||||
const [faces, setFaces] = useState<Faces | null>(null);
|
||||
const [failed, setFailed] = useState(cache === null);
|
||||
const onFailure = useCallback(() => setFailed(true), []);
|
||||
useEffect(() => {
|
||||
if (cache === null) return;
|
||||
let active = true;
|
||||
void Promise.all([cache.load(400), cache.load(700)])
|
||||
.then(([regular, bold]) => {
|
||||
// IMPORTANT: a shared page font can finish after this grid unmounts. Only the page
|
||||
// owns its lifetime; this grid must neither paint late nor close another grid's face.
|
||||
if (active) setFaces({ 400: regular, 700: bold });
|
||||
})
|
||||
.catch(() => {
|
||||
if (active) setFailed(true);
|
||||
});
|
||||
return () => {
|
||||
active = false;
|
||||
};
|
||||
}, [cache]);
|
||||
const readiness = failed
|
||||
? copy.unavailable
|
||||
: faces === null
|
||||
? copy.loading
|
||||
: undefined;
|
||||
const reasons = new Map<string, string>();
|
||||
const entries = TEXT_PRESETS.map((preset) => {
|
||||
const reason = readiness ?? refusal(preset);
|
||||
if (reason !== undefined && !reasons.has(reason))
|
||||
reasons.set(reason, `${prefix}-${reasons.size}`);
|
||||
return { preset, reason, isSelected: selected?.(preset) ?? false };
|
||||
});
|
||||
return (
|
||||
<section className="h3-nle-presets" aria-label={copy.heading}>
|
||||
<h4>{copy.heading}</h4>
|
||||
<div className="h3-nle-preset-grid">
|
||||
{entries.map(({ preset, reason, isSelected }) => (
|
||||
<button
|
||||
key={preset.id}
|
||||
type="button"
|
||||
className="h3-nle-preset"
|
||||
data-h3-nle-control={
|
||||
mode === "insert" ? "title.insert_preset" : "text.apply_preset"
|
||||
}
|
||||
data-h3-nle-preset={preset.id}
|
||||
aria-label={fill(copy[mode], { name: copy.names[preset.id] })}
|
||||
aria-pressed={mode === "apply" ? isSelected : undefined}
|
||||
aria-describedby={
|
||||
reason === undefined ? undefined : reasons.get(reason)
|
||||
}
|
||||
disabled={reason !== undefined || isSelected}
|
||||
onClick={() => {
|
||||
if (reason === undefined && !isSelected) onChoose(preset);
|
||||
}}
|
||||
>
|
||||
{!failed && faces !== null && (
|
||||
<PresetSample
|
||||
preset={preset}
|
||||
faces={faces}
|
||||
onFailure={onFailure}
|
||||
/>
|
||||
)}
|
||||
<span>{copy.names[preset.id]}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
{[...reasons].map(([reason, id]) => (
|
||||
<p key={reason} id={id} className="h3-nle-note">
|
||||
{reason}
|
||||
</p>
|
||||
))}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -7,6 +7,23 @@ import type { PrimaryAppendNotice } from "./nleCommandBuilders";
|
||||
|
||||
export const copy = {
|
||||
en: {
|
||||
presets: {
|
||||
heading: "Title styles",
|
||||
insert: "Insert {name}",
|
||||
apply: "Apply {name}",
|
||||
loading: "Loading style previews…",
|
||||
unavailable: "Style previews are unavailable.",
|
||||
names: {
|
||||
outline: "Outline",
|
||||
outlineYellow: "Yellow outline",
|
||||
dropShadow: "Drop shadow",
|
||||
outlineShadow: "Outline and shadow",
|
||||
captionBox: "Caption box",
|
||||
highlight: "Highlight",
|
||||
inverseBox: "Inverse box",
|
||||
boldOutline: "Bold outline",
|
||||
},
|
||||
},
|
||||
launcher: "Open full editor",
|
||||
launcherBusy: "Opening full editor…",
|
||||
unsupported: "The full editor is unavailable in this browser.",
|
||||
@@ -128,7 +145,7 @@ export const copy = {
|
||||
pillAdded: "Added",
|
||||
pillImported: "Imported",
|
||||
addToTimeline: "Add to timeline",
|
||||
// D-6: "+" states what Add does today ( makes it append to Main).
|
||||
// D-6: Add appends to Main; thumbnail-card activation works in both media bins.
|
||||
addNamed: "Add {name} to the timeline",
|
||||
addTip: "Append to the end of the primary video track",
|
||||
addPrimaryMissing: "Add refused: the primary video track is unavailable.",
|
||||
@@ -153,10 +170,12 @@ export const copy = {
|
||||
font: "Font {ordinal}",
|
||||
addTitle: "Add title",
|
||||
titleRefusals: {
|
||||
font_italic_unsupported:
|
||||
"These characters support regular and bold only. Turn off italic for this text.",
|
||||
busy: "Wait for the current edit to finish.",
|
||||
missing_font: "Choose an available font before adding a title.",
|
||||
font_glyph_unsupported:
|
||||
"The bundled title font cannot render some of these characters. Use supported Latin, Greek or Cyrillic characters.",
|
||||
"The bundled title font cannot render some of these characters. Use supported Latin, Greek, Cyrillic or CJK characters.",
|
||||
invalid_content:
|
||||
"Use 1–2,048 characters and at most 32 lines, without unsupported control characters.",
|
||||
unavailable_frame: "Choose a valid playhead position.",
|
||||
@@ -273,7 +292,7 @@ export const copy = {
|
||||
selectedSourceOnly: "Selected source only",
|
||||
selectedSourceNone: "Select a clip with a source to preview it.",
|
||||
emptyHint:
|
||||
"Press + on a thumbnail in Media, or drag it to the timeline, to preview it here.",
|
||||
"Click a thumbnail in Media to add it to the timeline and preview it here.",
|
||||
},
|
||||
audio: {
|
||||
title: "Embedded audio",
|
||||
@@ -379,7 +398,7 @@ export const copy = {
|
||||
clip: "{name}, {start}–{end}, {duration}",
|
||||
titleClip: "Title",
|
||||
railLabel: "{name} · {start}–{end}",
|
||||
emptyLane: "Drag media here, or press + on a thumbnail",
|
||||
emptyLane: "Click a thumbnail in Media to add it here",
|
||||
selected: "selected",
|
||||
trimStart: "Trim start of {name}",
|
||||
snap: "Snap edges",
|
||||
@@ -656,7 +675,7 @@ export const copy = {
|
||||
approveImport:
|
||||
"Creates the proposed segments in the Production project. Nothing is queued for generation.",
|
||||
readiness:
|
||||
"Checks whether the imported plan can be generated with the current host, models and extension.",
|
||||
"Checks plan and host support. Frame sources are checked when you start generation.",
|
||||
addRow: "Adds a five-second shot after the last row.",
|
||||
admitReviewed: "Uses your edited shot rows as this plan's storyboard.",
|
||||
createPlannedProject:
|
||||
@@ -670,7 +689,7 @@ export const copy = {
|
||||
idle: "Readiness not checked",
|
||||
requesting: "Checking readiness…",
|
||||
held: "Not ready to generate",
|
||||
ready: "Ready to generate",
|
||||
ready: "Plan ready; frame sources are checked at generation",
|
||||
error: "Readiness check unavailable",
|
||||
},
|
||||
start: "Generate approved sequence",
|
||||
@@ -735,6 +754,23 @@ export const copy = {
|
||||
},
|
||||
},
|
||||
"zh-TW": {
|
||||
presets: {
|
||||
heading: "標題樣式",
|
||||
insert: "插入{name}",
|
||||
apply: "套用{name}",
|
||||
loading: "正在載入樣式預覽…",
|
||||
unavailable: "樣式預覽無法使用。",
|
||||
names: {
|
||||
outline: "描邊",
|
||||
outlineYellow: "黃色描邊",
|
||||
dropShadow: "陰影",
|
||||
outlineShadow: "描邊與陰影",
|
||||
captionBox: "字幕底框",
|
||||
highlight: "醒目標示",
|
||||
inverseBox: "反白底框",
|
||||
boldOutline: "粗體描邊",
|
||||
},
|
||||
},
|
||||
launcher: "開啟完整剪輯器",
|
||||
launcherBusy: "正在開啟完整剪輯器…",
|
||||
unsupported: "此瀏覽器無法使用完整剪輯器。",
|
||||
@@ -868,10 +904,11 @@ export const copy = {
|
||||
font: "字型 {ordinal}",
|
||||
addTitle: "加入標題",
|
||||
titleRefusals: {
|
||||
font_italic_unsupported: "這段文字僅支援一般與粗體。請關閉斜體。",
|
||||
busy: "請等目前的編輯完成。",
|
||||
missing_font: "請先選擇可用字型,再加入標題。",
|
||||
font_glyph_unsupported:
|
||||
"封裝的標題字型無法顯示其中部分字元。請使用支援的拉丁文、希臘文或西里爾文字元。",
|
||||
"封裝的標題字型無法顯示其中部分字元。請使用支援的拉丁文、希臘文、西里爾文或中日韓字元。",
|
||||
invalid_content:
|
||||
"請使用 1–2,048 個字元、最多 32 行,且不要包含不支援的控制字元。",
|
||||
unavailable_frame: "請選擇有效的播放位置。",
|
||||
@@ -978,8 +1015,7 @@ export const copy = {
|
||||
},
|
||||
selectedSourceOnly: "僅顯示所選來源",
|
||||
selectedSourceNone: "選取含來源的片段以預覽。",
|
||||
emptyHint:
|
||||
"按「媒體」中縮圖上的「+」,或將它拖曳到時間軸,即可在此預覽。",
|
||||
emptyHint: "按一下「媒體」中的縮圖,即可放到時間軸上並在此預覽。",
|
||||
},
|
||||
audio: {
|
||||
title: "內嵌音訊",
|
||||
@@ -1077,7 +1113,7 @@ export const copy = {
|
||||
clip: "{name},{start}–{end},{duration}",
|
||||
titleClip: "標題",
|
||||
railLabel: "{name} · {start}–{end}",
|
||||
emptyLane: "將素材拖曳到這裡,或按縮圖上的「+」",
|
||||
emptyLane: "按一下「媒體」中的縮圖,即可加入此處",
|
||||
selected: "已選取",
|
||||
trimStart: "修剪 {name} 的起點",
|
||||
snap: "邊緣吸附",
|
||||
@@ -1338,7 +1374,7 @@ export const copy = {
|
||||
"顯示分鏡列,讓你在採用前編輯每個鏡頭的文字、時間與硬邊界。",
|
||||
propose: "將分鏡拆成製作片段,並列出各片段的時長與模式供你檢視。",
|
||||
approveImport: "在製作專案中建立提議的片段。不會排入任何生成工作。",
|
||||
readiness: "檢查目前的主機、模型與擴充功能能否生成已匯入的計畫。",
|
||||
readiness: "檢查計畫與主機支援。開始生成時才會檢查影格來源。",
|
||||
addRow: "在最後一列之後新增一個 5 秒的鏡頭。",
|
||||
admitReviewed: "使用你編輯過的分鏡列作為此計畫的分鏡。",
|
||||
createPlannedProject:
|
||||
@@ -1351,7 +1387,7 @@ export const copy = {
|
||||
idle: "尚未檢查就緒狀態",
|
||||
requesting: "正在檢查就緒狀態…",
|
||||
held: "尚未就緒,無法生成",
|
||||
ready: "可以生成",
|
||||
ready: "計畫已就緒;生成時才會檢查影格來源",
|
||||
error: "無法檢查就緒狀態",
|
||||
},
|
||||
start: "生成已核准的序列",
|
||||
@@ -1412,6 +1448,23 @@ export const copy = {
|
||||
},
|
||||
},
|
||||
"zh-CN": {
|
||||
presets: {
|
||||
heading: "标题样式",
|
||||
insert: "插入{name}",
|
||||
apply: "应用{name}",
|
||||
loading: "正在加载样式预览…",
|
||||
unavailable: "样式预览不可用。",
|
||||
names: {
|
||||
outline: "描边",
|
||||
outlineYellow: "黄色描边",
|
||||
dropShadow: "阴影",
|
||||
outlineShadow: "描边与阴影",
|
||||
captionBox: "字幕底框",
|
||||
highlight: "醒目标记",
|
||||
inverseBox: "反白底框",
|
||||
boldOutline: "粗体描边",
|
||||
},
|
||||
},
|
||||
launcher: "打开完整剪辑器",
|
||||
launcherBusy: "正在打开完整剪辑器…",
|
||||
unsupported: "此浏览器无法使用完整剪辑器。",
|
||||
@@ -1545,10 +1598,11 @@ export const copy = {
|
||||
font: "字体 {ordinal}",
|
||||
addTitle: "添加标题",
|
||||
titleRefusals: {
|
||||
font_italic_unsupported: "这段文字仅支持常规和粗体。请关闭斜体。",
|
||||
busy: "请等待当前编辑完成。",
|
||||
missing_font: "请先选择可用字体,再添加标题。",
|
||||
font_glyph_unsupported:
|
||||
"随附的标题字体无法显示其中部分字符。请使用支持的拉丁文、希腊文或西里尔文字符。",
|
||||
"随附的标题字体无法显示其中部分字符。请使用支持的拉丁文、希腊文、西里尔文或中日韩字符。",
|
||||
invalid_content:
|
||||
"请使用 1–2,048 个字符、最多 32 行,且不要包含不支持的控制字符。",
|
||||
unavailable_frame: "请选择有效的播放位置。",
|
||||
@@ -1655,7 +1709,7 @@ export const copy = {
|
||||
},
|
||||
selectedSourceOnly: "仅显示所选来源",
|
||||
selectedSourceNone: "选择含来源的片段以预览。",
|
||||
emptyHint: "按“媒体”中缩略图上的“+”,或将它拖到时间线,即可在此预览。",
|
||||
emptyHint: "点击“媒体”中的缩略图,即可放到时间线上并在此预览。",
|
||||
},
|
||||
audio: {
|
||||
title: "内嵌音频",
|
||||
@@ -1753,7 +1807,7 @@ export const copy = {
|
||||
clip: "{name},{start}–{end},{duration}",
|
||||
titleClip: "标题",
|
||||
railLabel: "{name} · {start}–{end}",
|
||||
emptyLane: "将素材拖到这里,或按缩略图上的“+”",
|
||||
emptyLane: "点击“媒体”中的缩略图,即可添加到此处",
|
||||
selected: "已选中",
|
||||
trimStart: "修剪 {name} 的起点",
|
||||
snap: "边缘吸附",
|
||||
@@ -2015,7 +2069,7 @@ export const copy = {
|
||||
"显示分镜行,让你在采用前编辑每个镜头的文字、时间与硬边界。",
|
||||
propose: "将分镜拆成制作片段,并列出各片段的时长与模式供你查看。",
|
||||
approveImport: "在制作项目中创建提议的片段。不会排入任何生成任务。",
|
||||
readiness: "检查当前的主机、模型与扩展能否生成已导入的计划。",
|
||||
readiness: "检查计划与主机支持。开始生成时才会检查帧来源。",
|
||||
addRow: "在最后一行之后新增一个 5 秒的镜头。",
|
||||
admitReviewed: "使用你编辑过的分镜行作为此计划的分镜。",
|
||||
createPlannedProject:
|
||||
@@ -2028,7 +2082,7 @@ export const copy = {
|
||||
idle: "尚未检查就绪状态",
|
||||
requesting: "正在检查就绪状态…",
|
||||
held: "尚未就绪,无法生成",
|
||||
ready: "可以生成",
|
||||
ready: "计划已就绪;生成时才会检查帧来源",
|
||||
error: "无法检查就绪状态",
|
||||
},
|
||||
start: "生成已批准的序列",
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import regular from "../../../../comfyui_h3_context/fonts/NotoSans-Regular.ttf";
|
||||
import bold from "../../../../comfyui_h3_context/fonts/NotoSans-Bold.ttf";
|
||||
import { loadPackagedFace } from "../../runtime/visualCompositionResources";
|
||||
|
||||
export type PresetFontOwner = Readonly<{ family: string; close(): void }>;
|
||||
type Weight = 400 | 700;
|
||||
|
||||
export function createTitlePresetFontCache(
|
||||
load: (weight: Weight) => Promise<PresetFontOwner>,
|
||||
) {
|
||||
const pending = new Map<Weight, Promise<PresetFontOwner>>();
|
||||
const owners = new Set<PresetFontOwner>();
|
||||
let closed = false;
|
||||
return {
|
||||
load(weight: Weight): Promise<PresetFontOwner> {
|
||||
if (closed) return Promise.reject(new Error("font owner closed"));
|
||||
let result = pending.get(weight);
|
||||
if (result === undefined) {
|
||||
result = Promise.resolve()
|
||||
.then(() => load(weight))
|
||||
.then((owner) => {
|
||||
// IMPORTANT: page disposal can precede FontFace.load; a late face must be removed
|
||||
// instead of resurrecting the page's font owner after cleanup.
|
||||
if (closed) {
|
||||
owner.close();
|
||||
throw new Error("font owner closed");
|
||||
}
|
||||
owners.add(owner);
|
||||
return owner;
|
||||
});
|
||||
// Keep rejected promises too: remounting a grid must not retry an unavailable face.
|
||||
pending.set(weight, result);
|
||||
}
|
||||
return result;
|
||||
},
|
||||
close() {
|
||||
if (closed) return;
|
||||
closed = true;
|
||||
for (const owner of owners) owner.close();
|
||||
owners.clear();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
let pageFonts: ReturnType<typeof createTitlePresetFontCache> | undefined;
|
||||
export function getTitlePresetFonts() {
|
||||
if (typeof FontFace === "undefined") return null;
|
||||
if (pageFonts === undefined) {
|
||||
pageFonts = createTitlePresetFontCache(async (weight) => {
|
||||
// Library mode embeds these assets; the dev server returns their exact allowed URLs.
|
||||
const response = await fetch(weight === 700 ? bold : regular);
|
||||
if (!response.ok) throw new Error("packaged font unavailable");
|
||||
const bytes = await response.arrayBuffer();
|
||||
if (bytes.byteLength === 0 || bytes.byteLength > 12 * 1024 * 1024)
|
||||
throw new Error("packaged font unavailable");
|
||||
return loadPackagedFace(
|
||||
bytes,
|
||||
`h3-preset-${crypto.randomUUID()}`,
|
||||
String(weight),
|
||||
"normal",
|
||||
);
|
||||
});
|
||||
window.addEventListener("pagehide", () => pageFonts?.close(), {
|
||||
once: true,
|
||||
});
|
||||
}
|
||||
return pageFonts;
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
import type { TextStyleWire } from "./nleCommandBuilders";
|
||||
export type TextPresetId =
|
||||
| "outline"
|
||||
| "outlineYellow"
|
||||
| "dropShadow"
|
||||
| "outlineShadow"
|
||||
| "captionBox"
|
||||
| "highlight"
|
||||
| "inverseBox"
|
||||
| "boldOutline";
|
||||
export type TextPreset = Readonly<{
|
||||
id: TextPresetId;
|
||||
style: Pick<
|
||||
TextStyleWire,
|
||||
| "weight"
|
||||
| "style"
|
||||
| "fill_rgba"
|
||||
| "background_rgba"
|
||||
| "stroke"
|
||||
| "shadow"
|
||||
| "background_padding_px"
|
||||
>;
|
||||
}>;
|
||||
function freeze<T>(value: T): T {
|
||||
if (value !== null && typeof value === "object") {
|
||||
for (const child of Object.values(value)) freeze(child);
|
||||
Object.freeze(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
const white = [255, 255, 255, 255] as const;
|
||||
const black = [0, 0, 0, 255] as const;
|
||||
const yellow = [255, 255, 0, 255] as const;
|
||||
const normal = {
|
||||
weight: 400,
|
||||
style: "normal",
|
||||
fill_rgba: white,
|
||||
background_rgba: null,
|
||||
} as const;
|
||||
export const TEXT_PRESETS: readonly TextPreset[] = freeze([
|
||||
{ id: "outline", style: { ...normal, stroke: { rgba: black, width_px: 3 } } },
|
||||
{
|
||||
id: "outlineYellow",
|
||||
style: {
|
||||
...normal,
|
||||
fill_rgba: yellow,
|
||||
stroke: { rgba: black, width_px: 4 },
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "dropShadow",
|
||||
style: {
|
||||
...normal,
|
||||
shadow: { rgba: [0, 0, 0, 128], offset_x_px: 3, offset_y_px: 3 },
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "outlineShadow",
|
||||
style: {
|
||||
...normal,
|
||||
stroke: { rgba: black, width_px: 3 },
|
||||
shadow: { rgba: [0, 0, 0, 128], offset_x_px: 3, offset_y_px: 3 },
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "captionBox",
|
||||
style: {
|
||||
...normal,
|
||||
background_rgba: [0, 0, 0, 153],
|
||||
background_padding_px: 8,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "highlight",
|
||||
style: {
|
||||
...normal,
|
||||
fill_rgba: black,
|
||||
background_rgba: yellow,
|
||||
background_padding_px: 6,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "inverseBox",
|
||||
style: {
|
||||
...normal,
|
||||
fill_rgba: black,
|
||||
background_rgba: white,
|
||||
background_padding_px: 8,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "boldOutline",
|
||||
style: {
|
||||
...normal,
|
||||
weight: 700,
|
||||
stroke: { rgba: black, width_px: 5 },
|
||||
shadow: { rgba: [0, 0, 0, 102], offset_x_px: 2, offset_y_px: 2 },
|
||||
},
|
||||
},
|
||||
] satisfies TextPreset[]);
|
||||
|
||||
export function applyPreset(
|
||||
style: TextStyleWire,
|
||||
preset: TextPreset,
|
||||
): TextStyleWire {
|
||||
// Replace the complete decoration group: merging leaves an old shadow or padding behind.
|
||||
const {
|
||||
stroke: _stroke,
|
||||
shadow: _shadow,
|
||||
background_padding_px: _padding,
|
||||
...base
|
||||
} = style;
|
||||
return { ...base, ...preset.style };
|
||||
}
|
||||
@@ -2,32 +2,47 @@ import manifest from "../../../../comfyui_h3_context/fonts/font_manifest_v1.json
|
||||
import type { TextStyleWire } from "./nleCommandBuilders";
|
||||
|
||||
/** Match the packaged reader's exact face/fallback coverage, never browser/system fonts. */
|
||||
export function titleTextCovered(
|
||||
export function resolveTitleFont(
|
||||
text: string,
|
||||
style: Pick<TextStyleWire, "font_asset_id" | "weight" | "style">,
|
||||
): boolean {
|
||||
if (!text || !manifest.fallback_order.includes(style.font_asset_id))
|
||||
return false;
|
||||
): { artifactId: string; fontAssetId: string } | { reason: string } {
|
||||
if (!text) return { reason: "font_glyph_unsupported" };
|
||||
if (!manifest.fallback_order.includes(style.font_asset_id))
|
||||
return { reason: "font_asset_unsupported" };
|
||||
if (
|
||||
![400, 700].includes(style.weight) ||
|
||||
!["normal", "italic"].includes(style.style)
|
||||
)
|
||||
return { reason: "font_style_unsupported" };
|
||||
const face = (id: string) =>
|
||||
manifest.font_assets
|
||||
.find((asset) => asset.font_asset_id === id)
|
||||
?.faces.find(
|
||||
(face) => face.weight === style.weight && face.style === style.style,
|
||||
);
|
||||
const primary = face(style.font_asset_id);
|
||||
if (!primary) return false;
|
||||
const candidates = [
|
||||
primary,
|
||||
...manifest.fallback_order
|
||||
.filter((id) => id !== style.font_asset_id)
|
||||
.map(face),
|
||||
// IMPORTANT: regional cmaps overlap. Coverage alone chooses TC for Japanese/Korean;
|
||||
// match the backend's script preference to preserve the default regional glyph forms.
|
||||
const preferred = /[\u3040-\u30ff\u31f0-\u31ff\uff66-\uff9d]/u.test(text)
|
||||
? "h3.font.noto_sans_jp.v1"
|
||||
: /[\u1100-\u11ff\u3130-\u318f\ua960-\ua97f\uac00-\ud7ff\uffa0-\uffdc]/u.test(
|
||||
text,
|
||||
)
|
||||
? "h3.font.noto_sans_kr.v1"
|
||||
: null;
|
||||
const order = [
|
||||
...new Set([
|
||||
style.font_asset_id,
|
||||
...(preferred ? [preferred] : []),
|
||||
...manifest.fallback_order,
|
||||
]),
|
||||
];
|
||||
return candidates.some((candidate) => {
|
||||
if (!candidate) return false;
|
||||
for (const id of order) {
|
||||
const candidate = face(id);
|
||||
if (!candidate) continue;
|
||||
const profile = manifest.coverage_profiles.find(
|
||||
(row) => row.profile_id === candidate.coverage_profile_id,
|
||||
);
|
||||
return (
|
||||
if (
|
||||
!!profile &&
|
||||
Array.from(text).every((character) => {
|
||||
const point = character.codePointAt(0)!;
|
||||
@@ -39,6 +54,30 @@ export function titleTextCovered(
|
||||
)
|
||||
);
|
||||
})
|
||||
);
|
||||
});
|
||||
)
|
||||
return { artifactId: candidate.artifact_id, fontAssetId: id };
|
||||
}
|
||||
if (
|
||||
style.style === "italic" &&
|
||||
!("reason" in resolveTitleFont(text, { ...style, style: "normal" }))
|
||||
)
|
||||
return { reason: "font_italic_unsupported" };
|
||||
return { reason: "font_glyph_unsupported" };
|
||||
}
|
||||
|
||||
export function titleTextCovered(
|
||||
text: string,
|
||||
style: Pick<TextStyleWire, "font_asset_id" | "weight" | "style">,
|
||||
): boolean {
|
||||
return !("reason" in resolveTitleFont(text, style));
|
||||
}
|
||||
|
||||
export function titleTextRefusal(
|
||||
text: string,
|
||||
style: Pick<TextStyleWire, "font_asset_id" | "weight" | "style">,
|
||||
): "font_glyph_unsupported" | "font_italic_unsupported" {
|
||||
const decision = resolveTitleFont(text, style);
|
||||
return "reason" in decision && decision.reason === "font_italic_unsupported"
|
||||
? "font_italic_unsupported"
|
||||
: "font_glyph_unsupported";
|
||||
}
|
||||
|
||||
@@ -4,11 +4,12 @@ import type {
|
||||
} from "../../contracts/authoringWorkbenchCodec";
|
||||
import type { PublicCompositionSnapshot } from "../../contracts/compositionCodec";
|
||||
import type { AuthoringIntent } from "../../state/authoringViewState";
|
||||
import { titleTextCovered } from "./nleTitleCoverage";
|
||||
import { titleTextCovered, titleTextRefusal } from "./nleTitleCoverage";
|
||||
import {
|
||||
build,
|
||||
DEFAULT_TEXT_STYLE,
|
||||
freshIdentifier,
|
||||
type TextStyleWire,
|
||||
} from "./nleCommandBuilders";
|
||||
|
||||
export type TitleInsertionAuthority =
|
||||
@@ -18,6 +19,7 @@ export type TitleInsertionRefusal =
|
||||
| "missing_font"
|
||||
| "invalid_content"
|
||||
| "font_glyph_unsupported"
|
||||
| "font_italic_unsupported"
|
||||
| "unavailable_frame"
|
||||
| "insufficient_capacity"
|
||||
| "clip_limit"
|
||||
@@ -41,6 +43,7 @@ export function planTitleInsertion(
|
||||
frame: number;
|
||||
fontId: string;
|
||||
content: string;
|
||||
style?: TextStyleWire;
|
||||
}>,
|
||||
): TitleInsertionDecision {
|
||||
if (input.busy) return refuse("busy");
|
||||
@@ -65,13 +68,12 @@ export function planTitleInsertion(
|
||||
/[\u0000-\u0008\u000b-\u001f\ud800-\udfff]/u.test(content)
|
||||
)
|
||||
return refuse("invalid_content");
|
||||
if (
|
||||
!titleTextCovered(content, {
|
||||
...DEFAULT_TEXT_STYLE,
|
||||
font_asset_id: input.fontId,
|
||||
})
|
||||
)
|
||||
return refuse("font_glyph_unsupported");
|
||||
const style = {
|
||||
...(input.style ?? DEFAULT_TEXT_STYLE),
|
||||
font_asset_id: input.fontId,
|
||||
};
|
||||
if (!titleTextCovered(content, style))
|
||||
return refuse(titleTextRefusal(content, style));
|
||||
if (!Number.isSafeInteger(input.frame)) return refuse("unavailable_frame");
|
||||
const capacity =
|
||||
"editCapacityFrames" in authority
|
||||
@@ -113,7 +115,7 @@ export function planTitleInsertion(
|
||||
startFrame,
|
||||
durationFrames,
|
||||
sourceStartFrame: 0,
|
||||
text: { ...DEFAULT_TEXT_STYLE, font_asset_id: input.fontId, content },
|
||||
text: { ...style, content },
|
||||
}),
|
||||
);
|
||||
return {
|
||||
|
||||
@@ -2860,3 +2860,33 @@
|
||||
.h3-nle-media-tools button {
|
||||
justify-self: start;
|
||||
}
|
||||
|
||||
.h3-nle-presets {
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
gap: 0.5rem;
|
||||
padding-block: 0.75rem;
|
||||
}
|
||||
.h3-nle-preset-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr));
|
||||
gap: 0.5rem;
|
||||
min-width: 0;
|
||||
}
|
||||
.h3-nle-preset {
|
||||
display: grid;
|
||||
grid-template-rows: 1fr auto;
|
||||
align-content: start;
|
||||
gap: 0.25rem;
|
||||
min-width: 0;
|
||||
text-align: center;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.h3-nle-preset canvas {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
aspect-ratio: 8 / 3;
|
||||
background: var(--h3-preset-backdrop);
|
||||
border-radius: var(--h3-radius-control, 0.25rem);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
// vocabulary in front of the user the first time a new code appears.
|
||||
|
||||
import type { Locale } from "../i18n/catalog";
|
||||
import { sidebarCopy } from "../i18n/catalog";
|
||||
|
||||
type Table = Readonly<{
|
||||
fallback: string;
|
||||
@@ -73,10 +74,12 @@ const en: Tables = {
|
||||
"This ComfyUI host does not provide every native MiniMax H3 workflow that sequence generation needs.",
|
||||
qualification_composition_unqualified:
|
||||
"This ComfyUI host does not provide every native MiniMax H3 workflow that sequence generation needs.",
|
||||
native_source_structure_unrecognized:
|
||||
"The MiniMax H3 nodes in this ComfyUI are a version this extension cannot use for longer videos. Update ComfyUI; if it is already up to date, update this extension when a newer version is available. A single clip in H3 App Mode still works.",
|
||||
qualification_compiler_unavailable:
|
||||
"This extension's files could not be read. Reinstall the extension.",
|
||||
qualification_host_bindings_unavailable:
|
||||
"Sequence generation supports text-to-video segments without reference media.",
|
||||
"Sequence generation supports Text to Video, Image to Video, Last Frame and First-Last Frame. Reference to Video sequences are not available yet. For a frame plan, update ComfyUI's native frame and guide support, then check readiness again.",
|
||||
qualification_changed:
|
||||
"The host, models or extension changed during the check. Check readiness again.",
|
||||
},
|
||||
@@ -87,9 +90,9 @@ const en: Tables = {
|
||||
hard_content_crosses_boundary:
|
||||
"A cut falls inside a shot that must stay whole: a hard boundary, exact dialogue or visible text. Change the target, the policy or the shot timing.",
|
||||
local_reference_unavailable:
|
||||
"A segment needs a reference that its generation mode cannot use.",
|
||||
"A shot refers to media unavailable in its segment. Keep frame references in their first or last segment, or supply an ordinary reference image for appearance that continues across segments.",
|
||||
required_asset_missing:
|
||||
"A segment needs a first frame, last frame or reference image that the Context does not have.",
|
||||
"A segment lacks the media its generation mode needs. Add the required media, such as an ordinary reference image for Reference to Video. For frame-only input, use Image to Video, First-Last Frame or Last Frame.",
|
||||
native_mapping_unavailable:
|
||||
"This host has no native generation mode for a segment.",
|
||||
managed_execution_qualification_pending:
|
||||
@@ -159,7 +162,16 @@ const en: Tables = {
|
||||
invalid_response:
|
||||
"The server's reply could not be used. Reconnect; the sequence may have expired.",
|
||||
unsupported_prepared_context:
|
||||
"This segment cannot be generated here: sequence generation supports text-to-video segments without reference media and prompts up to 4,096 characters.",
|
||||
"This segment needs Text to Video, Image to Video, Last Frame or First-Last Frame, its declared frame sources and a prompt of up to 4,096 characters. Reference to Video sequences are not available yet.",
|
||||
sequence_media_binding_missing:
|
||||
"Choose the required first or last frame from a Load Image node on the original workflow, then generate again.",
|
||||
sequence_media_binding_invalid:
|
||||
"Reselect the plan's frame sources from Load Image nodes on the original workflow, then generate again.",
|
||||
compile_failed: sidebarCopy("en").errorMessages.compile_failed,
|
||||
sequence_media_changed:
|
||||
"A declared frame source or crop changed. Restore the original image and crop, then retry. To use different media, cancel any running sequence and generate again.",
|
||||
sequence_media_unavailable:
|
||||
"A declared frame source is unavailable. Restore its Load Image node and image on the original workflow, then retry the segment or generate again.",
|
||||
artifact_content_invalid:
|
||||
"The generated video did not pass verification. Retry the segment.",
|
||||
artifact_locator_rejected:
|
||||
@@ -434,10 +446,12 @@ const zhTW: Tables = {
|
||||
"此 ComfyUI 主機未提供序列生成所需的全部原生 MiniMax H3 工作流程。",
|
||||
qualification_composition_unqualified:
|
||||
"此 ComfyUI 主機未提供序列生成所需的全部原生 MiniMax H3 工作流程。",
|
||||
native_source_structure_unrecognized:
|
||||
"此 ComfyUI 內的 MiniMax H3 節點版本無法用於此擴充功能的較長影片。請更新 ComfyUI;若已是最新版本,請在此擴充功能推出新版時更新。H3 App Mode 的單一片段仍可使用。",
|
||||
qualification_compiler_unavailable:
|
||||
"無法讀取此擴充功能的檔案,請重新安裝擴充功能。",
|
||||
qualification_host_bindings_unavailable:
|
||||
"序列生成支援不含參考媒體的文字轉影片片段。",
|
||||
"序列生成支援 Text to Video、Image to Video、Last Frame 與 First-Last Frame,尚未支援 Reference to Video 序列。若是影格計畫,請更新 ComfyUI 的原生影格與引導節點支援,再重新檢查就緒狀態。",
|
||||
qualification_changed:
|
||||
"檢查期間主機、模型或擴充功能已變更,請再檢查一次。",
|
||||
},
|
||||
@@ -447,9 +461,10 @@ const zhTW: Tables = {
|
||||
codes: {
|
||||
hard_content_crosses_boundary:
|
||||
"有剪接點落在必須保持完整的鏡頭內(硬邊界、精確對白或畫面文字)。請變更目標時長、分段策略或鏡頭時間。",
|
||||
local_reference_unavailable: "有片段需要其生成模式無法使用的參考素材。",
|
||||
local_reference_unavailable:
|
||||
"鏡頭引用了該片段無法使用的素材。請將影格引用保留在其所屬的第一段或最後一段,或提供一般參考圖片以維持跨片段的外觀。",
|
||||
required_asset_missing:
|
||||
"有片段需要首影格、尾影格或參考圖片,但 Context 中沒有。",
|
||||
"片段缺少其生成模式所需的素材。請補上必要素材,例如為 Reference to Video 補上一般參考圖片。若只有首尾影格,請使用 Image to Video、First-Last Frame 或 Last Frame。",
|
||||
native_mapping_unavailable: "此主機沒有對應片段的原生生成模式。",
|
||||
managed_execution_qualification_pending: "匯入計畫後請檢查就緒狀態。",
|
||||
managed_execution_unsupported: "此主機無法執行序列生成。",
|
||||
@@ -505,7 +520,16 @@ const zhTW: Tables = {
|
||||
"伺服器拒絕了此序列步驟。請重新整理後重試或取消。",
|
||||
invalid_response: "無法使用伺服器的回應。請重新連線;序列可能已過期。",
|
||||
unsupported_prepared_context:
|
||||
"此片段無法在此生成:序列生成支援不含參考媒體、提示詞不超過 4,096 個字元的文字轉影片片段。",
|
||||
"此片段需要 Text to Video、Image to Video、Last Frame 或 First-Last Frame、已宣告的影格來源,以及不超過 4,096 個字元的提示詞。尚未支援 Reference to Video 序列。",
|
||||
sequence_media_binding_missing:
|
||||
"請從原始工作流程的 Load Image 節點選擇必要的首影格或尾影格,再重新生成。",
|
||||
sequence_media_binding_invalid:
|
||||
"請從原始工作流程的 Load Image 節點重新選擇計畫的影格來源,再重新生成。",
|
||||
compile_failed: sidebarCopy("zh-TW").errorMessages.compile_failed,
|
||||
sequence_media_changed:
|
||||
"已宣告的影格來源或裁切已變更。請還原原始影像與裁切後重試。若要改用其他媒體,請取消任何執行中的序列,再重新生成。",
|
||||
sequence_media_unavailable:
|
||||
"無法使用已宣告的影格來源。請在原始工作流程還原其 Load Image 節點與影像,再重試片段或重新生成。",
|
||||
artifact_content_invalid: "生成的影片未通過驗證。請重試該片段。",
|
||||
artifact_locator_rejected: "生成的影片檔案遺失或已變更。請重試該片段。",
|
||||
artifact_store_unavailable:
|
||||
@@ -736,10 +760,12 @@ const zhCN: Tables = {
|
||||
"此 ComfyUI 主机未提供序列生成所需的全部原生 MiniMax H3 工作流。",
|
||||
qualification_composition_unqualified:
|
||||
"此 ComfyUI 主机未提供序列生成所需的全部原生 MiniMax H3 工作流。",
|
||||
native_source_structure_unrecognized:
|
||||
"此 ComfyUI 内的 MiniMax H3 节点版本无法用于此扩展的较长视频。请更新 ComfyUI;若已是最新版本,请在此扩展推出新版时更新。H3 App Mode 的单个片段仍可使用。",
|
||||
qualification_compiler_unavailable:
|
||||
"无法读取此扩展的文件,请重新安装扩展。",
|
||||
qualification_host_bindings_unavailable:
|
||||
"序列生成支持不含参考媒体的文本生成视频片段。",
|
||||
"序列生成支持 Text to Video、Image to Video、Last Frame 和 First-Last Frame,尚不支持 Reference to Video 序列。如果是帧计划,请更新 ComfyUI 的原生帧与引导节点支持,再重新检查就绪状态。",
|
||||
qualification_changed: "检查期间主机、模型或扩展已变更,请再检查一次。",
|
||||
},
|
||||
},
|
||||
@@ -748,9 +774,10 @@ const zhCN: Tables = {
|
||||
codes: {
|
||||
hard_content_crosses_boundary:
|
||||
"有剪切点落在必须保持完整的镜头内(硬边界、精确对白或画面文字)。请更改目标时长、分段策略或镜头时间。",
|
||||
local_reference_unavailable: "有片段需要其生成模式无法使用的参考素材。",
|
||||
local_reference_unavailable:
|
||||
"镜头引用了该片段无法使用的素材。请将帧引用保留在其所属的第一段或最后一段,或提供普通参考图片以维持跨片段的外观。",
|
||||
required_asset_missing:
|
||||
"有片段需要首帧、尾帧或参考图片,但 Context 中没有。",
|
||||
"片段缺少其生成模式所需的素材。请补上必要素材,例如为 Reference to Video 补上普通参考图片。若只有首尾帧,请使用 Image to Video、First-Last Frame 或 Last Frame。",
|
||||
native_mapping_unavailable: "此主机没有对应片段的原生生成模式。",
|
||||
managed_execution_qualification_pending: "导入计划后请检查就绪状态。",
|
||||
managed_execution_unsupported: "此主机无法执行序列生成。",
|
||||
@@ -804,7 +831,16 @@ const zhCN: Tables = {
|
||||
prepared_context_rejected: "服务器拒绝了此序列步骤。请刷新后重试或取消。",
|
||||
invalid_response: "无法使用服务器的响应。请重新连接;序列可能已过期。",
|
||||
unsupported_prepared_context:
|
||||
"此片段无法在此生成:序列生成支持不含参考媒体、提示词不超过 4,096 个字符的文本生成视频片段。",
|
||||
"此片段需要 Text to Video、Image to Video、Last Frame 或 First-Last Frame、已声明的帧来源,以及不超过 4,096 个字符的提示词。尚不支持 Reference to Video 序列。",
|
||||
sequence_media_binding_missing:
|
||||
"请从原始工作流的 Load Image 节点选择必要的首帧或尾帧,再重新生成。",
|
||||
sequence_media_binding_invalid:
|
||||
"请从原始工作流的 Load Image 节点重新选择计划的帧来源,再重新生成。",
|
||||
compile_failed: sidebarCopy("zh-CN").errorMessages.compile_failed,
|
||||
sequence_media_changed:
|
||||
"已声明的帧来源或裁剪已更改。请恢复原始图像与裁剪后重试。如需使用其他媒体,请取消任何运行中的序列,再重新生成。",
|
||||
sequence_media_unavailable:
|
||||
"无法使用已声明的帧来源。请在原始工作流恢复其 Load Image 节点与图像,再重试片段或重新生成。",
|
||||
artifact_content_invalid: "生成的视频未通过验证。请重试该片段。",
|
||||
artifact_locator_rejected: "生成的视频文件丢失或已变更。请重试该片段。",
|
||||
artifact_store_unavailable:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user