diff --git a/README.md b/README.md index b1880da..293c84e 100644 --- a/README.md +++ b/README.md @@ -156,14 +156,15 @@ Recommended safe defaults: | Continuity | Balanced - 22 frames | | Audio Continuity | On | | Audio Seam | Auto | -| Report Detail | Basic | | Regenerate From | Auto | | Run Storage | Off for short tests; Save + Auto Resume for long runs | | SageAttention | Auto when backend compatibility is unknown | ## H3 Continuum Sampler UI -The production node keeps normal generation controls visible and marks infrequent controls as native ComfyUI **Advanced** widgets. Most users only need the main controls. +The V3.3 production node keeps normal generation controls visible and moves developer-only options to ComfyUI Settings. Connection-specific controls appear only when the related input or Run Storage mode is active. + +![H3 Continuum V3.3 streamlined sampler and assembler](docs/images/h3-continuum-v33-streamlined-ui.png) ### Main inputs and controls @@ -187,15 +188,26 @@ Reference images and First/Last Frame are mutually exclusive. Reference Audio ca | --- | --- | --- | | Prompt Format | Auto | Detect Fixed, List, or Timeline prompts. | | Audio Continuity | On | Carry raw audio context between chunks. | -| Report Detail | Basic | Select the amount of status and diagnostic text. | -| Regenerate From | Auto | Resume normally, or regenerate from a selected saved chunk. | -| `reroll_nonce` | 0 | Automatic Revision behavior. Positive values provide explicit legacy branch selection. | -| Strict Compatibility | On | Stop only on H3 contracts that are actually unsafe or unsupported. | -| Debug | Off | Enable additional troubleshooting output. | -| Show Preview | On | Show normal progress and preview information. | | Run Storage | Off | Use `Save + Auto Resume` for long or interruptible runs. | -| Run Name | blank | Optional manual storage-name override. Automatic identification is used when blank. | -| Reference Size | Match Output | Choose practical output-area matching or larger identity preservation. | +| Run Name | blank | Appears with `Save + Auto Resume`; optionally overrides the automatic storage identity. | +| Regenerate From | Auto | Appears with `Save + Auto Resume`; reuse normally or regenerate from a selected saved chunk. | +| Variation Nonce | 0 | Appears only for explicit chunk regeneration and creates a deliberate alternate revision. | +| Reference Size | Match Output | Appears when a Reference Image is connected. | +| Timeline Video Size | Efficient - 0.4 MP | Appears when Timeline Video is connected. | + +### ComfyUI settings + +The following package-wide options are available in ComfyUI Settings instead of occupying every sampler and assembler node: + +![H3 Continuum settings](docs/images/h3-continuum-v33-settings.png) + +| Setting | Default | Use | +| --- | --- | --- | +| H3 Continuum: Sampling Preview | On | Show normal sampling preview/progress information. | +| H3 Continuum: Developer Diagnostics | Off | Enable developer-oriented diagnostics when troubleshooting. | +| H3 Continuum: Detailed Report | Off | Expand sampler and assembly status text. Normal generation does not require it. | + +These settings are applied when the workflow is queued. Hidden legacy widgets remain compatible with older saved workflows, while unknown or merged MODEL filenames are not rejected by name. ### Outputs @@ -246,6 +258,60 @@ Natural ending. `Prompt Format = Auto` detects Fixed, List, or Timeline syntax. +### Local LLM / Qwen prompt generation + +MiniMax provides the official [H3 prompt-writing skill](https://github.com/MiniMax-AI/MiniMax-H3/tree/main/skills/h3-prompt-writing) for T2VA, I2VA, FL2VA, L2VA, and Ref2VA. Give a local agent the complete `h3-prompt-writing` folder, not only `SKILL.md`, because the detailed formats and examples are stored under `references/`. + +The official skill defines the H3 prompt fields and reference-label rules. H3 Continuum adds one routing requirement: divide the visual progression into one prompt section per Continuum chunk. The currently validated workflow uses 5-second chunks. + +For reliable output, use `Prompt Format = Timeline` or `Auto` and require: + +- exactly one non-empty section per configured chunk; +- sequential ranges such as `[0-5s]`, `[5-10s]`, and `[10-15s]`; +- shared Ref2VA subject and reference definitions only once, before the first timeline section; +- only labels for active connected inputs, using compact Core numbering; +- a different action, camera, and scene progression for each section; +- no explanatory text outside the final H3 prompt. + +If fewer usable sections are produced, Continuum may reuse the previous available section. Matching the requested chunk count is therefore strongly recommended. + +Copy-paste system instruction for a local LLM: + +```text +You write production prompts for ComfyUI-H3-Continuum V3.3. + +Use the complete official MiniMax H3 prompt-writing skill as the authority for +T2VA, I2VA, FL2VA, L2VA, and Ref2VA field order, syntax, and reference labels. + +The user will provide: +- generation mode; +- chunk count; +- seconds per chunk; +- active image, video, and audio inputs; +- scene requirements. + +Output rules: +1. Output only the final H3 prompt. Do not add explanations or Markdown fences. +2. Produce exactly one non-empty Timeline section per requested chunk. +3. Use sequential headers calculated from the supplied chunk duration. For three + 5-second chunks, use exactly [0-5s], [5-10s], and [10-15s]. +4. Every section must describe the action, camera movement, scene progression, + and relevant sound for that interval. Continue naturally from the previous + section; do not repeat the first section. +5. Mention only active connected references. Number Picture, Video, and Audio + labels compactly in ComfyUI Core order. Never mention bypassed, missing, or + unconnected inputs. +6. For Ref2VA, write subject_definitions, summary, and retention_analysis once + before the first Timeline header. In each Timeline section, provide that + chunk's detailed_description, overall_soundscape, and non_diegetic_music. +7. For T2VA, I2VA, FL2VA, and L2VA, each Timeline section must contain the + official integrated_multimodal_description, overall_soundscape, and + non_diegetic_music structure for that chunk. +8. Preserve requested dialogue, lyrics, and visible text verbatim and in their + requested language. Follow the official H3 dialogue and reference syntax. +9. Do not claim guaranteed frame-perfect continuity or exact audio copying. +``` + ## Run Storage and automatic resume For long generations: @@ -295,7 +361,7 @@ Select `Chunk N` in `Regenerate From` to reuse chunks before N and regenerate N ## Spectrum-aware continuation -With a compatible [ComfyUI Spectrum MiniMax H3](https://github.com/xmarre/ComfyUI-Spectrum-MiniMax-H3), Continuum requests **Actual Prefix 2** for continuation chunks through Interop API v1. Upstream integration is currently pending in [PR #52](https://github.com/xmarre/ComfyUI-Spectrum-MiniMax-H3/pull/52); until it is merged, use the validated PR/Fork receiver and confirm the acceptance log below. +With [ComfyUI Spectrum MiniMax H3](https://github.com/xmarre/ComfyUI-Spectrum-MiniMax-H3), Continuum requests **Actual Prefix 2** for continuation chunks through Interop API v1. First-class H3 Continuum API v1 interoperability is included upstream in Spectrum v0.2.15 and later, so a current standard Spectrum installation can receive this request without a separate fork. Confirm the acceptance log below during runtime validation. ```text Chunk 1: normal path @@ -314,9 +380,9 @@ Spectrum H3: accepted H3 Continuum API v1, actual prefix=2 Actual Prefix 2 is active only when the Spectrum log reports that the Continuum API request was accepted. Older or incompatible Spectrum versions continue without that receiver behavior. -### Benefits after the Spectrum upstream merge +### Benefits of the upstream Spectrum integration -Once the Continuum receiver is included in an official Spectrum release, users no longer need a Continuum-specific Spectrum fork or local patch. Installing or updating Spectrum through its normal distribution path will preserve the integration. +The Continuum receiver is included in the official Spectrum release, so users no longer need a Continuum-specific Spectrum fork or local patch. Installing or updating Spectrum through its normal distribution path preserves the integration. - **Automatic handshake:** Continuum emits the request only for continuation chunks, and Spectrum applies Actual Prefix 2 when it recognizes Interop API v1. - **Safer chunk transitions:** the first two Transformer evaluations after a new raw AV Context are evaluated normally before Spectrum forecasting resumes. This is intended to reduce forecast instability immediately after a chunk boundary; it does not guarantee that every visible seam or flicker will disappear. @@ -359,7 +425,7 @@ Turbo LoRA files are available from [LightX2V MiniMax H3 Turbo](https://huggingf Connect decoded chunk images, audio, and `assembly_plan` to `H3 Continuum Assemble + Seam`. -- Default: `Audio Seam = Auto`, `Video Seam = Auto`, `Report Detail = Basic`. +- Default: `Audio Seam = Auto`, `Video Seam = Auto`. - Video modes: `Auto`, `Auto 2`, `Analyze Only`, `Off`. - `Auto` applies guarded transient and micro-flash correction without frame deletion. - `Auto 2` additionally enables guarded exposure-ramp correction and remains experimental. @@ -394,7 +460,7 @@ resume=complete `accelerator markers not detected (informational only)` is not an error. It only means the optional accelerator marker was not observable. -Use `Report Detail = Basic` normally. Enable detailed diagnostics and `debug` only when troubleshooting. +Keep **Detailed Report** and **Developer Diagnostics** disabled normally. Enable them in ComfyUI Settings only when troubleshooting or collecting a diagnostic report. ## Compatibility and scope diff --git a/docs/images/h3-continuum-v33-settings.png b/docs/images/h3-continuum-v33-settings.png new file mode 100644 index 0000000..8834db4 Binary files /dev/null and b/docs/images/h3-continuum-v33-settings.png differ diff --git a/docs/images/h3-continuum-v33-streamlined-ui.png b/docs/images/h3-continuum-v33-streamlined-ui.png new file mode 100644 index 0000000..96eacf4 Binary files /dev/null and b/docs/images/h3-continuum-v33-streamlined-ui.png differ diff --git a/tests/test_v32_reference.py b/tests/test_v32_reference.py index 716c672..55d73b7 100644 --- a/tests/test_v32_reference.py +++ b/tests/test_v32_reference.py @@ -11,7 +11,7 @@ from ComfyUI_H3_Continuum_Join.reference import ( validate_reference_prompts, ) from ComfyUI_H3_Continuum_Join.reference_audio import validate_reference_audio_prompts -from ComfyUI_H3_Continuum_Join.v3.nodes import _validate_reference_checkpoint +from ComfyUI_H3_Continuum_Join.v3 import nodes as v3_nodes def test_reference_size_is_appended_after_v31_widgets(): @@ -182,32 +182,5 @@ def test_connected_audio_keeps_unavailable_extra_tag_as_warning(): assert "H3C-P103" in message -def _reference_prompt(checkpoint_name: str) -> dict: - return { - "1": { - "class_type": "UNETLoader", - "inputs": {"unet_name": checkpoint_name}, - }, - "2": { - "class_type": "H3ContinuumSamplerProduction", - "inputs": {"model": ["1", 0]}, - }, - } - - -def test_reference_checkpoint_classification_is_diagnostic_only(): - assert _validate_reference_checkpoint( - _reference_prompt("minimax_h3_ref2va_pruned_int8.safetensors"), - "2", - strict_compatibility=True, - ) == "ref2va" - assert _validate_reference_checkpoint( - _reference_prompt("minimax_h3_fl2va_pruned_int8.safetensors"), - "2", - strict_compatibility=True, - ) == "fl2va" - assert _validate_reference_checkpoint( - _reference_prompt("minimax_h3_unknown.safetensors"), - "2", - strict_compatibility=True, - ) == "unknown" +def test_reference_checkpoint_filename_classification_is_removed(): + assert not hasattr(v3_nodes, "_validate_reference_checkpoint") diff --git a/v3/assembly.py b/v3/assembly.py index 1b5e476..10ae62c 100644 --- a/v3/assembly.py +++ b/v3/assembly.py @@ -2,6 +2,8 @@ from __future__ import annotations +import math +import time from typing import Any import torch @@ -48,6 +50,13 @@ def _chunk_list(value: Any) -> list[Any]: return [value] +def _format_elapsed(seconds: float) -> str: + total = max(0.0, float(seconds)) + hours, remainder = divmod(total, 3600.0) + minutes, seconds = divmod(remainder, 60.0) + return f"{int(hours):02d}:{int(minutes):02d}:{seconds:05.2f}" + + def assemble_decoded_chunks( *, images: list[Any], @@ -213,6 +222,11 @@ def assemble_decoded_chunks( ) if duration_report: reports.append(duration_report) + runtime_started_at = plan.get("_runtime_started_at") + if isinstance(runtime_started_at, (int, float)): + elapsed = time.perf_counter() - float(runtime_started_at) + if math.isfinite(elapsed) and elapsed >= 0.0: + reports.append(f"Total workflow elapsed: {_format_elapsed(elapsed)}") return image_buffer.contiguous(), result_audio, "\n".join(reports) @@ -230,7 +244,13 @@ class H3ContinuumAssembleV3: "images": ("IMAGE",), "audio": ("AUDIO",), "assembly_plan": ("H3_CONTINUUM_ASSEMBLY_PLAN",), - "exact_total_duration": ("BOOLEAN", {"default": True}), + "exact_total_duration": ( + "BOOLEAN", + { + "default": True, + "tooltip": "Adjust the final output to the exact requested total duration.", + }, + ), "audio_seam": ( AUDIO_SEAM_OPTIONS, { diff --git a/v3/nodes.py b/v3/nodes.py index 9f05a00..939be59 100644 --- a/v3/nodes.py +++ b/v3/nodes.py @@ -2,6 +2,9 @@ from __future__ import annotations +import time + +from ..constants import DIAGNOSTICS_FULL from ..v2.nodes import ( CATEGORY, DIAGNOSTICS_OPTIONS, @@ -51,17 +54,6 @@ def _validate_regenerate_storage(run_storage: str, regenerate_from: int) -> None ) -def _validate_reference_checkpoint( - prompt, unique_id, *, strict_compatibility: bool -) -> str: - from ..graph_contract import classify_h3_checkpoint - - # Checkpoint choice is diagnostic only. Strict Compatibility remains - # reserved for H3 contracts that are actually unsafe or unsupported. - _ = strict_compatibility - return classify_h3_checkpoint(prompt, unique_id) - - class H3ContinuumAdvancedV3: DESCRIPTION = ( "Optional continuation, session, reroll, and diagnostics settings for V3." @@ -414,25 +406,56 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3): { "default": PROMPT_FORMAT_OPTIONS[0], "display_name": "Prompt Format", + "tooltip": "Auto accepts Fixed, list-separated, and timeline prompt styles.", **advanced, }, ), - "chunks": ("INT", {"default": 3, "min": 1, "max": 16, "step": 1}), + "chunks": ( + "INT", + { + "default": 3, + "min": 1, + "max": 16, + "step": 1, + "tooltip": "Number of sequential Continuum chunks to generate.", + }, + ), "chunk_seconds": ( "FLOAT", - {"default": 5.0, "min": 4.0, "max": 15.0, "step": 0.1}, + { + "default": 5.0, + "min": 4.0, + "max": 15.0, + "step": 0.1, + "tooltip": "Target duration per chunk. Five seconds is the validated default.", + }, ), "width": ( "INT", - {"default": 1344, "min": 32, "max": 16384, "step": 32}, + { + "default": 1344, + "min": 32, + "max": 16384, + "step": 32, + "tooltip": "Output width. Use a multiple of 32.", + }, ), "height": ( "INT", - {"default": 768, "min": 32, "max": 16384, "step": 32}, + { + "default": 768, + "min": 32, + "max": 16384, + "step": 32, + "tooltip": "Output height. Use a multiple of 32.", + }, ), "continuity": ( V2_CONTINUITY_OPTIONS, - {"default": V2_CONTINUITY_OPTIONS[1]}, + { + "default": V2_CONTINUITY_OPTIONS[1], + "tooltip": "Amount of prior video context retained at each chunk boundary.", + }, ), "base_seed": ( "INT", @@ -441,11 +464,19 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3): "min": 0, "max": 0xFFFFFFFFFFFFFFFF, "control_after_generate": True, + "tooltip": "Base seed used to derive deterministic per-chunk seeds.", }, ), "audio_continuity": ( "BOOLEAN", - {"default": True, "advanced": True}, + { + "default": True, + "advanced": True, + "tooltip": ( + "On passes prior audio context into continuation chunks. " + "Turn it off only to isolate or replace generated audio." + ), + }, ), "diagnostics": ( DIAGNOSTICS_OPTIONS, @@ -476,6 +507,11 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3): "max": 0xFFFFFFFF, "step": 1, "advanced": True, + "display_name": "Variation Nonce", + "tooltip": ( + "Change only when regenerating an explicit chunk and you want " + "a new variation with otherwise identical settings." + ), }, ), "strict_compatibility": ( @@ -583,6 +619,7 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3): reference_audio_vae=None, timeline_video_source=None, ): + runtime_started_at = time.perf_counter() from ..reference import prepare_reference_assets from ..reference_audio import prepare_reference_audio_source regenerate_from = _regenerate_from_value( @@ -605,24 +642,10 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3): raise ValueError( "Reference Images cannot be combined with First Frame or Last Frame" ) - reference_checkpoint = None - if reference_assets is not None or timeline_video_source is not None: - reference_checkpoint = _validate_reference_checkpoint( - prompt, - unique_id, - strict_compatibility=bool(strict_compatibility), - ) - - def report_with_reference_status(report): - if reference_checkpoint is None: - return str(report) - if reference_checkpoint == "ref2va": - status = "Ref2VA verified." - elif reference_checkpoint == "fl2va": - status = "FL2VA; allowed, but reference fidelity may differ from Ref2VA." - else: - status = "unverified; execution allowed, Core contract errors remain fatal." - return str(report) + "\nReference MODEL: " + status + def mark_runtime_start(assembly_plan): + marked = dict(assembly_plan) + marked["_runtime_started_at"] = runtime_started_at + return marked def execute(): return super(H3ContinuumSamplerProduction, self).run( @@ -663,8 +686,8 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3): return ( video_latents, audio_latents, - assembly_plan, - report_with_reference_status(result["report"]), + mark_runtime_start(assembly_plan), + str(result["report"]), ) if run_storage != "Save + Auto Resume": raise ValueError(f"unknown Run Storage mode: {run_storage!r}") @@ -683,12 +706,12 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3): ) as storage: video_latents, audio_latents, assembly_plan, result = execute() result = dict(result) - report = report_with_reference_status(result["report"]) + "\n" + storage.summary( - detailed=diagnostics == DIAGNOSTICS_OPTIONS[-1] + report = str(result["report"]) + "\n" + storage.summary( + detailed=diagnostics == DIAGNOSTICS_FULL ) result["report"] = report storage.finalize(session=result["session"], report=report) - return video_latents, audio_latents, assembly_plan, report + return video_latents, audio_latents, mark_runtime_start(assembly_plan), report class H3ContinuumSamplerTimelineVideo(H3ContinuumSamplerProduction): diff --git a/web/project_id.js b/web/project_id.js index b3db55c..f4521f6 100644 --- a/web/project_id.js +++ b/web/project_id.js @@ -2,11 +2,21 @@ import { app } from "../../scripts/app.js"; const PRODUCTION_NODE_CLASS = "H3ContinuumSamplerProduction"; const TIMELINE_NODE_CLASS = "H3ContinuumSamplerTimelineVideo"; +const ASSEMBLE_SEAM_NODE_CLASS = "H3ContinuumAssembleSeamExperimental"; const PROJECT_WIDGET = "project_id"; const LEGACY_RUN_NAME_WIDGET = "run_name"; const CHUNKS_WIDGET = "chunks"; const REGENERATE_WIDGET = "reroll_from_chunk"; +const REROLL_NONCE_WIDGET = "reroll_nonce"; +const RUN_STORAGE_WIDGET = "run_storage"; +const REFERENCE_SIZE_WIDGET = "reference_size"; +const TIMELINE_SIZE_WIDGET = "timeline_video_size"; const PROMPT_OVERRIDES_INPUT = "prompt_overrides"; +const SETTINGS = { + detailedReport: "H3Continuum.DetailedReport", + developerDiagnostics: "H3Continuum.DeveloperDiagnostics", + samplingPreview: "H3Continuum.SamplingPreview", +}; function createProjectId() { if (globalThis.crypto?.randomUUID) { @@ -24,16 +34,61 @@ function findWidget(node, name) { return node.widgets?.find((widget) => widget.name === name); } -function hidePersistentWidget(widget) { - if (!widget || widget.__h3ContinuumHidden) { +function setWidgetVisible(widget, visible) { + if (!widget) { return; } - widget.__h3ContinuumHidden = true; - widget.hidden = true; - widget.type = "converted-widget"; + if (!widget.__h3ContinuumOriginal) { + widget.__h3ContinuumOriginal = { + type: widget.type, + computeSize: widget.computeSize, + hidden: widget.hidden, + optionsHidden: widget.options?.hidden, + }; + } widget.options ||= {}; - widget.options.hidden = true; - widget.computeSize = () => [0, -4]; + if (visible) { + const original = widget.__h3ContinuumOriginal; + widget.type = original.type; + widget.computeSize = original.computeSize; + widget.hidden = original.hidden; + if (original.optionsHidden === undefined) { + delete widget.options.hidden; + } else { + widget.options.hidden = original.optionsHidden; + } + } else { + widget.hidden = true; + widget.type = "converted-widget"; + widget.options.hidden = true; + widget.computeSize = () => [0, -4]; + } +} + +function hidePersistentWidget(widget) { + setWidgetVisible(widget, false); +} + +function settingValue(id, fallback) { + try { + return app.ui?.settings?.getSettingValue?.(id) ?? fallback; + } catch { + return fallback; + } +} + +function applyRuntimeSettings(node) { + const detailed = Boolean(settingValue(SETTINGS.detailedReport, false)); + const debug = Boolean(settingValue(SETTINGS.developerDiagnostics, false)); + const preview = Boolean(settingValue(SETTINGS.samplingPreview, true)); + const diagnosticsWidget = findWidget(node, "diagnostics"); + const debugWidget = findWidget(node, "debug"); + const previewWidget = findWidget(node, "show_preview"); + const strictWidget = findWidget(node, "strict_compatibility"); + if (diagnosticsWidget) diagnosticsWidget.value = detailed ? "Detailed Report" : "Basic"; + if (debugWidget) debugWidget.value = debug; + if (previewWidget) previewWidget.value = preview; + if (strictWidget) strictWidget.value = true; } function removeUnusedInput(node, name) { @@ -86,10 +141,78 @@ function configureRegenerateFrom(node) { refresh(); } +function linkedInput(node, names) { + return node.inputs?.some((input) => names.includes(input.name) && input.link != null) ?? false; +} + +function attachRefresh(widget, key, refresh) { + if (!widget || widget[key]) { + return; + } + const previous = widget.callback; + widget.callback = function(value, ...args) { + const result = previous?.call(this, value, ...args); + refresh(); + return result; + }; + widget[key] = true; +} + +function configureConditionalWidgets(node) { + const storageWidget = findWidget(node, RUN_STORAGE_WIDGET); + const regenerateWidget = findWidget(node, REGENERATE_WIDGET); + const nonceWidget = findWidget(node, REROLL_NONCE_WIDGET); + const runNameWidget = findWidget(node, LEGACY_RUN_NAME_WIDGET); + const refresh = () => { + const storageEnabled = storageWidget?.value === "Save + Auto Resume"; + const explicitRegeneration = storageEnabled + && regenerateWidget?.value !== "Auto" + && Number.parseInt(String(regenerateWidget?.value).replace(/^Chunk\s+/, ""), 10) > 0; + setWidgetVisible(regenerateWidget, storageEnabled); + setWidgetVisible(runNameWidget, storageEnabled); + setWidgetVisible(nonceWidget, explicitRegeneration); + setWidgetVisible( + findWidget(node, REFERENCE_SIZE_WIDGET), + linkedInput(node, ["reference_image_1", "reference_image_2", "reference_image_3"]), + ); + setWidgetVisible( + findWidget(node, TIMELINE_SIZE_WIDGET), + linkedInput(node, ["timeline_video"]), + ); + node.setDirtyCanvas?.(true, true); + }; + attachRefresh(storageWidget, "__h3ContinuumStorageCallback", refresh); + attachRefresh(regenerateWidget, "__h3ContinuumRegenerateVisibilityCallback", refresh); + if (!node.__h3ContinuumConnectionCallback) { + const previous = node.onConnectionsChange; + node.onConnectionsChange = function(...args) { + const result = previous?.apply(this, args); + setTimeout(refresh, 0); + return result; + }; + node.__h3ContinuumConnectionCallback = true; + } + refresh(); +} + +function configureAssembler(node) { + if (node.comfyClass !== ASSEMBLE_SEAM_NODE_CLASS) { + return false; + } + const exactDuration = findWidget(node, "exact_total_duration"); + if (exactDuration) exactDuration.value = true; + applyRuntimeSettings(node); + hidePersistentWidget(exactDuration); + hidePersistentWidget(findWidget(node, "diagnostics")); + node.setDirtyCanvas?.(true, true); + return true; +} + function configureNode(node) { const isProduction = node.comfyClass === PRODUCTION_NODE_CLASS; const isTimeline = node.comfyClass === TIMELINE_NODE_CLASS; if (!isProduction && !isTimeline) { + configureAssembler(node); return null; } const projectWidget = findWidget(node, PROJECT_WIDGET); @@ -97,13 +220,18 @@ function configureNode(node) { if (projectWidget && !String(projectWidget.value || "").trim()) { projectWidget.value = createProjectId(); } - hidePersistentWidget(findWidget(node, LEGACY_RUN_NAME_WIDGET)); removeUnusedInput(node, PROMPT_OVERRIDES_INPUT); } + applyRuntimeSettings(node); + hidePersistentWidget(findWidget(node, "diagnostics")); + hidePersistentWidget(findWidget(node, "strict_compatibility")); + hidePersistentWidget(findWidget(node, "debug")); + hidePersistentWidget(findWidget(node, "show_preview")); hidePersistentWidget(projectWidget); configureRegenerateFrom(node); + configureConditionalWidgets(node); node.setDirtyCanvas?.(true, true); - return isProduction ? projectWidget : null; + return projectWidget; } function configureNodeAfterSetup(node) { @@ -115,6 +243,34 @@ function configureNodeAfterSetup(node) { app.registerExtension({ name: "H3Continuum.ProjectId", + setup() { + const settings = app.ui?.settings; + settings?.addSetting?.({ + id: SETTINGS.samplingPreview, + name: "H3 Continuum: Sampling Preview", + type: "boolean", + defaultValue: true, + tooltip: "Show live sampling previews. Disable only to reduce preview overhead.", + onChange: () => refreshConfiguredNodes(), + }); + settings?.addSetting?.({ + id: SETTINGS.developerDiagnostics, + name: "H3 Continuum: Developer Diagnostics", + type: "boolean", + defaultValue: false, + tooltip: "Enable developer-only Continuum logging and assertions.", + onChange: () => refreshConfiguredNodes(), + }); + settings?.addSetting?.({ + id: SETTINGS.detailedReport, + name: "H3 Continuum: Detailed Report", + type: "boolean", + defaultValue: false, + tooltip: "Include detailed diagnostics in status and assembly reports.", + onChange: () => refreshConfiguredNodes(), + }); + }, + nodeCreated(node) { configureNodeAfterSetup(node); }, @@ -133,6 +289,22 @@ app.registerExtension({ const seen = new Set(); for (const node of app.graph?._nodes || []) { const projectWidget = configureNode(node); + const apiNode = prompt.output?.[String(node.id)]; + if (apiNode?.inputs) { + if (node.comfyClass === PRODUCTION_NODE_CLASS || node.comfyClass === TIMELINE_NODE_CLASS) { + apiNode.inputs.diagnostics = settingValue(SETTINGS.detailedReport, false) + ? "Detailed Report" + : "Basic"; + apiNode.inputs.debug = Boolean(settingValue(SETTINGS.developerDiagnostics, false)); + apiNode.inputs.show_preview = Boolean(settingValue(SETTINGS.samplingPreview, true)); + apiNode.inputs.strict_compatibility = true; + } else if (node.comfyClass === ASSEMBLE_SEAM_NODE_CLASS) { + apiNode.inputs.diagnostics = settingValue(SETTINGS.detailedReport, false) + ? "Detailed Report" + : "Basic"; + apiNode.inputs.exact_total_duration = true; + } + } if (!projectWidget) { continue; } @@ -142,10 +314,15 @@ app.registerExtension({ projectWidget.value = projectId; } seen.add(projectId); - const apiNode = prompt.output?.[String(node.id)]; if (apiNode?.inputs) { apiNode.inputs.project_id = projectId; } } }, }); + +function refreshConfiguredNodes() { + for (const node of app.graph?._nodes || []) { + configureNodeAfterSetup(node); + } +}