@gobing-ai/knowledge-kit 0.1.29 → 0.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/board/api.js +8724 -3861
  3. package/dist/board/collect/index.js +69 -1
  4. package/dist/board/daily-voice/index.js +474 -265
  5. package/dist/board/itc/index.js +69 -1
  6. package/dist/board/wiki/index.css +1305 -0
  7. package/dist/board/wiki/index.js +1621 -0
  8. package/dist/index.js +34689 -28532
  9. package/package.json +1 -1
  10. package/plugins/generations/content-gen/dist/index.js +14 -1
  11. package/plugins/generations/core-facts-gen/dist/index.js +14 -1
  12. package/plugins/generations/daily-article-gen/dist/index.js +14 -1
  13. package/plugins/generations/dailynews-gen/dist/index.js +14 -1
  14. package/plugins/generations/episode-plan-gen/dist/index.js +32 -2
  15. package/plugins/generations/episode-plan-gen/src/index.ts +19 -1
  16. package/plugins/generations/gemini-tts/dist/index.js +14 -1
  17. package/plugins/generations/image-gen/dist/index.js +14 -1
  18. package/plugins/generations/music-gen/dist/index.js +15 -2
  19. package/plugins/generations/news-report-gen/dist/index.js +14 -1
  20. package/plugins/generations/vibe-voice-tts/dist/index.js +14 -1
  21. package/plugins/generations/video-gen/README.md +245 -8
  22. package/plugins/generations/video-gen/dist/index.js +22447 -4763
  23. package/plugins/generations/video-gen/package.json +1 -0
  24. package/plugins/generations/video-gen/presets/formats/avatar.yaml +5 -0
  25. package/plugins/generations/video-gen/presets/formats/editorial.yaml +6 -0
  26. package/plugins/generations/video-gen/presets/formats/hybrid-pip.yaml +5 -0
  27. package/plugins/generations/video-gen/presets/styles/daily-ai.yaml +5 -0
  28. package/plugins/generations/video-gen/presets/styles/neutral.yaml +3 -0
  29. package/plugins/generations/video-gen/python/colab_comfyui_h3.py +322 -0
  30. package/plugins/generations/video-gen/python/comfyui-h3-i2v-api.json +47 -0
  31. package/plugins/generations/video-gen/python/comfyui-h3-models.json +32 -0
  32. package/plugins/generations/video-gen/python/comfyui_model_cache.py +388 -0
  33. package/plugins/generations/video-gen/python/drive_client.py +187 -0
  34. package/plugins/generations/video-gen/src/brief-cli.ts +65 -0
  35. package/plugins/generations/video-gen/src/brief.ts +464 -0
  36. package/plugins/generations/video-gen/src/ccu-ledger.ts +206 -3
  37. package/plugins/generations/video-gen/src/colab-runner.ts +346 -35
  38. package/plugins/generations/video-gen/src/index.ts +141 -109
  39. package/plugins/generations/video-gen/src/inputs.ts +162 -4
  40. package/plugins/generations/video-gen/src/layout.ts +33 -0
  41. package/plugins/generations/video-gen/src/props.ts +27 -3
  42. package/plugins/generations/video-gen/src/remotion/AvatarReel.tsx +17 -1
  43. package/plugins/generations/video-gen/src/remotion/EditorialReel.tsx +17 -1
  44. package/plugins/generations/video-gen/src/remotion/Root.tsx +2 -0
  45. package/plugins/generations/video-gen/src/remotion/engine.ts +3 -7
  46. package/plugins/generations/video-gen/src/render.ts +25 -0
  47. package/plugins/generations/video-gen/src/request.ts +150 -20
  48. package/plugins/generations/video-gen/src/visual-provider.ts +116 -3
  49. package/plugins/generations/voice-gen/dist/index.js +14 -1
  50. package/plugins/generations/voxcpm-tts/dist/index.js +14 -1
  51. package/plugins/ingestions/aihot-ingest/dist/index.js +14 -1
  52. package/plugins/ingestions/horizon-ingest/dist/index.js +14 -1
  53. package/plugins/ingestions/last30days-ingest/dist/index.js +14 -1
  54. package/plugins/ingestions/web-search/dist/index.js +14 -1
  55. package/plugins/kk/config.example.yaml +1 -1
  56. package/plugins/kk/mcp-tools.yaml +47 -0
  57. package/plugins/kk/plugin.json +1 -1
  58. package/plugins/kk/publish-presets/itc-surfdash-locales.json +42 -0
  59. package/plugins/kk/scripts/daily-stages.ts +87 -6
  60. package/plugins/kk/scripts/kk-workflow-stages.ts +64 -9
  61. package/plugins/kk/scripts/video-stages.ts +332 -0
  62. package/plugins/kk/scripts/wiki-normalize-audio.ts +354 -0
  63. package/plugins/kk/scripts/wiki-normalize-document.ts +495 -0
  64. package/plugins/kk/scripts/wiki-normalize-stages.ts +96 -0
  65. package/plugins/kk/scripts/wiki-stage-runtime.ts +39 -0
  66. package/plugins/kk/skills/news-editorial/SKILL.md +2 -1
  67. package/plugins/kk/workflows/kk-collect.yaml +10 -0
  68. package/plugins/kk/workflows/kk-news-generate.yaml +70 -8
  69. package/plugins/kk/workflows/kk-smart-seo.yaml +8 -0
  70. package/plugins/kk/workflows/kk-storm-research.yaml +10 -0
  71. package/plugins/kk/workflows/kk-video-generate.yaml +169 -0
  72. package/plugins/kk/workflows/kk-wiki-digest.yaml +49 -0
  73. package/plugins/publishings/bilibili-pub/dist/index.js +281 -268
  74. package/plugins/publishings/bilibili-pub/dist/profile-check.js +202 -0
  75. package/plugins/publishings/cnblogs-pub/dist/index.js +281 -268
  76. package/plugins/publishings/cnblogs-pub/dist/profile-check.js +202 -0
  77. package/plugins/publishings/csdn-pub/dist/index.js +281 -268
  78. package/plugins/publishings/csdn-pub/dist/profile-check.js +216 -1
  79. package/plugins/publishings/emdash-pub/dist/index.js +33 -3
  80. package/plugins/publishings/infoq-pub/dist/index.js +281 -268
  81. package/plugins/publishings/infoq-pub/dist/profile-check.js +216 -1
  82. package/plugins/publishings/jike-pub/dist/index.js +281 -268
  83. package/plugins/publishings/jike-pub/dist/profile-check.js +216 -1
  84. package/plugins/publishings/juejin-pub/dist/index.js +281 -268
  85. package/plugins/publishings/juejin-pub/dist/profile-check.js +216 -1
  86. package/plugins/publishings/linkedin-pub/dist/index.js +281 -268
  87. package/plugins/publishings/linkedin-pub/dist/profile-check.js +216 -1
  88. package/plugins/publishings/medium-pub/dist/index.js +281 -268
  89. package/plugins/publishings/medium-pub/dist/profile-check.js +216 -1
  90. package/plugins/publishings/podcast-pub/dist/index.js +39 -9
  91. package/plugins/publishings/qiita-pub/dist/index.js +33 -3
  92. package/plugins/publishings/shipinhao-pub/dist/index.js +281 -268
  93. package/plugins/publishings/shipinhao-pub/dist/profile-check.js +175 -0
  94. package/plugins/publishings/sspai-pub/dist/index.js +281 -268
  95. package/plugins/publishings/sspai-pub/dist/profile-check.js +202 -0
  96. package/plugins/publishings/substack-pub/dist/index.js +281 -268
  97. package/plugins/publishings/substack-pub/dist/profile-check.js +216 -1
  98. package/plugins/publishings/surfdash-pub/dist/index.js +99 -39
  99. package/plugins/publishings/surfdash-pub/plugin.json +54 -0
  100. package/plugins/publishings/surfdash-pub/src/index.ts +36 -5
  101. package/plugins/publishings/threads-pub/dist/index.js +281 -268
  102. package/plugins/publishings/threads-pub/dist/profile-check.js +216 -1
  103. package/plugins/publishings/wechatmp-pub/dist/index.js +665 -451
  104. package/plugins/publishings/wechatmp-pub/dist/profile-check.js +215 -3
  105. package/plugins/publishings/weibo-pub/dist/index.js +281 -268
  106. package/plugins/publishings/weibo-pub/dist/profile-check.js +189 -1
  107. package/plugins/publishings/x-pub/dist/index.js +281 -268
  108. package/plugins/publishings/x-pub/dist/profile-check.js +216 -1
  109. package/plugins/publishings/xhs-pub/dist/index.js +281 -268
  110. package/plugins/publishings/xhs-pub/dist/profile-check.js +119 -1
  111. package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +281 -268
  112. package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +202 -0
  113. package/plugins/publishings/youtube-pub/dist/index.js +14 -1
  114. package/plugins/publishings/zenn-pub/dist/index.js +37 -7
@@ -7,6 +7,7 @@
7
7
  },
8
8
  "dependencies": {
9
9
  "@gobing-ai/kk-core": "workspace:*",
10
+ "@gobing-ai/kk-store": "workspace:*",
10
11
  "@gobing-ai/ts-runtime": "catalog:",
11
12
  "@gobing-ai/ts-utils": "catalog:",
12
13
  "@remotion/bundler": "4.0.547",
@@ -0,0 +1,5 @@
1
+ # Avatar format: a synthesized presenter fills the frame. Needs a portrait and a presenter provider.
2
+ visualMode: avatar
3
+ durationTargetSec: 60
4
+ presentation:
5
+ captionStyle: kinetic
@@ -0,0 +1,6 @@
1
+ # Editorial format: Ken-Burns stills (or Wan2.1 motion loops) under the caption shell.
2
+ # Portable data only — provider, GPU and credentials belong to the operator's video runtime.
3
+ visualMode: editorial
4
+ durationTargetSec: 60
5
+ presentation:
6
+ captionStyle: kinetic
@@ -0,0 +1,5 @@
1
+ # Hybrid PiP format: the editorial canvas with a MuseTalk host bubble. Needs both stills and a portrait.
2
+ visualMode: hybrid-pip
3
+ durationTargetSec: 60
4
+ presentation:
5
+ captionStyle: kinetic
@@ -0,0 +1,5 @@
1
+ # Daily AI style: the news episode's brand chip over the neutral look.
2
+ presentation:
3
+ captionStyle: kinetic
4
+ brandLabel: "AI 日报"
5
+ cta: "完整节目见播客 · 搜索「AI 日报」"
@@ -0,0 +1,3 @@
1
+ # Neutral style: the shipped look — kinetic captions, the shell's own podcast CTA, no brand chip.
2
+ presentation:
3
+ captionStyle: kinetic
@@ -0,0 +1,322 @@
1
+ #!/usr/bin/env python3
2
+ """MiniMax H3 first-frame motion worker for the Colab runtime (D91 R7, task 0459).
3
+
4
+ Contract (driven by `colab-runner.ts` through `KK_COLAB_ARGS`):
5
+
6
+ --first-frame <uploaded image> --out-dir <remote dir> [--frames <n>]
7
+ --api-graph <pinned json> # defaults to the sibling comfyui-h3-i2v-api.json
8
+
9
+ Steps, each bounded by one deadline:
10
+ 1. restore the pinned weights through 0458's cache (`comfyui_model_cache.restore`) — no upstream
11
+ download happens here;
12
+ 2. start ComfyUI on loopback and wait for `/object_info` to answer;
13
+ 3. verify every node the pinned graph needs is present — an image pinned to a newer ComfyUI fails
14
+ here instead of producing a silent bad clip;
15
+ 4. submit the graph with the validated first frame, the fixed motion prompt and the bounded frame
16
+ count, then poll `/history/<prompt_id>` until it reports the saved clip or the deadline passes;
17
+ 5. copy only the expected artifact (`clip-<i>.mp4`) into the out dir and print the worker result.
18
+
19
+ The narration is never regenerated: this worker produces a silent motion clip, and the shell keeps the
20
+ episode audio (`KK_COLAB_ARGS` carries no audio path on purpose).
21
+ """
22
+
23
+ from __future__ import annotations
24
+
25
+ import argparse
26
+ import json
27
+ import os
28
+ import shutil
29
+ import subprocess
30
+ import sys
31
+ import time
32
+ import urllib.error
33
+ import urllib.request
34
+ from pathlib import Path
35
+ from typing import NoReturn
36
+
37
+ WORKER_RESULT_MARKER = "KK_COLAB_RESULT "
38
+ COMFYUI_URL = "http://127.0.0.1:8188"
39
+ DEFAULT_DEADLINE_SEC = 1500
40
+ POLL_INTERVAL_SEC = 3
41
+
42
+
43
+ def fail(message: str) -> NoReturn:
44
+ print(f"colab_comfyui_h3: {message}", file=sys.stderr)
45
+ raise SystemExit(1)
46
+
47
+
48
+ def http_json(url: str, payload: dict | None = None, timeout: int = 30) -> dict:
49
+ data = None if payload is None else json.dumps(payload).encode("utf-8")
50
+ request = urllib.request.Request(
51
+ url,
52
+ data=data,
53
+ headers={"Content-Type": "application/json"} if data is not None else {},
54
+ method="POST" if data is not None else "GET",
55
+ )
56
+ with urllib.request.urlopen(request, timeout=timeout) as response: # noqa: S310 — loopback only
57
+ return json.loads(response.read().decode("utf-8"))
58
+
59
+
60
+ def load_graph(path: Path) -> dict:
61
+ try:
62
+ return json.loads(path.read_text(encoding="utf-8"))
63
+ except FileNotFoundError as error:
64
+ raise SystemExit(f"colab_comfyui_h3: api graph {path} is missing") from error
65
+ except json.JSONDecodeError as error:
66
+ raise SystemExit(f"colab_comfyui_h3: api graph {path} is not valid JSON: {error}") from error
67
+
68
+
69
+ def support_dir() -> Path:
70
+ """Where the sibling modules, graph and manifest live.
71
+
72
+ `colab exec --file` runs this source inside the VM's kernel, so its siblings are not next to it:
73
+ the runner stages them into `KK_COLAB_SUPPORT_DIR` (default /content/kk-support). A local run, or
74
+ a test, falls back to this file's own directory.
75
+ """
76
+ staged = Path(os.environ.get("KK_COLAB_SUPPORT_DIR", "/content/kk-support"))
77
+ return staged if staged.is_dir() else Path(globals()["__file__"]).resolve().parent
78
+
79
+
80
+ def stage_first_frame(first_frame: Path, comfy_root: Path) -> str:
81
+ """Copy the uploaded frame into ComfyUI's input/ folder, the only place LoadImage resolves names."""
82
+ target_dir = comfy_root / "input"
83
+ target_dir.mkdir(parents=True, exist_ok=True)
84
+ shutil.copyfile(first_frame, target_dir / first_frame.name)
85
+ return first_frame.name
86
+
87
+
88
+ def restore_weights(api_graph: dict, cache_dir: Path) -> dict:
89
+ """Restore the pinned set through the verified cache; a missing cache is an operator step."""
90
+ support = support_dir()
91
+ if str(support) not in sys.path:
92
+ sys.path.insert(0, str(support))
93
+ manifest = support / api_graph["models"]["manifest"]
94
+ from comfyui_model_cache import CacheError, load_manifest, restore
95
+ from drive_client import DriveTransportError, drive_transport
96
+
97
+ try:
98
+ receipt = restore(load_manifest(manifest), cache_dir, drive_transport())
99
+ except (CacheError, DriveTransportError) as error:
100
+ fail(f"model restore failed: {error}")
101
+ return receipt
102
+
103
+
104
+ def models_dir() -> Path:
105
+ """Where weights restore: ComfyUI's own models/ folder, which its loaders read without extra config."""
106
+ override = os.environ.get("KK_COMFYUI_MODELS")
107
+ if override:
108
+ return Path(override)
109
+ return Path(os.environ.get("KK_COMFYUI_ROOT", "/content/ComfyUI")) / "models"
110
+
111
+
112
+ def runtime_commit(comfy_root: Path) -> str | None:
113
+ """The checkout's real HEAD, so provenance reports what ran rather than what was pinned."""
114
+ if not (comfy_root / ".git").exists():
115
+ return None
116
+ result = subprocess.run( # noqa: S603 — fixed argv against the operator's checkout
117
+ ["git", "-C", str(comfy_root), "rev-parse", "HEAD"], capture_output=True, text=True, check=False
118
+ )
119
+ return result.stdout.strip() or None if result.returncode == 0 else None
120
+
121
+
122
+ def start_comfyui(graph: dict, deadline: float) -> subprocess.Popen:
123
+ """Start ComfyUI on loopback; the pinned commit's server is the only supported target."""
124
+ comfy_root = os.environ.get("KK_COMFYUI_ROOT", "/content/ComfyUI")
125
+ if not Path(comfy_root, "main.py").is_file():
126
+ fail(f"ComfyUI checkout not found at {comfy_root} (set KK_COMFYUI_ROOT)")
127
+ process = subprocess.Popen( # noqa: S603 — operator-provided checkout, fixed argv
128
+ [sys.executable, "main.py", "--listen", "127.0.0.1", "--port", "8188"],
129
+ cwd=comfy_root,
130
+ stdout=subprocess.DEVNULL,
131
+ stderr=subprocess.DEVNULL,
132
+ )
133
+ while time.time() < deadline:
134
+ try:
135
+ http_json(f"{COMFYUI_URL}/object_info", timeout=5)
136
+ return process
137
+ except (urllib.error.URLError, TimeoutError, ConnectionError):
138
+ time.sleep(POLL_INTERVAL_SEC)
139
+ process.terminate()
140
+ fail("ComfyUI did not answer /object_info before the deadline")
141
+
142
+
143
+ def assert_nodes(object_info: dict, required: list[str]) -> None:
144
+ missing = [node for node in required if node not in object_info]
145
+ if missing:
146
+ fail(f"the pinned graph needs node(s) this ComfyUI lacks: {', '.join(missing)}")
147
+
148
+
149
+ def build_prompt(api_graph: dict, first_frame_name: str, frames: int, save_node: str) -> dict:
150
+ """The pinned I2V graph, with the attempted first frame and the bounded frame count.
151
+
152
+ Mirrors upstream's `Image to Video (MiniMax H3)` blueprint at the pinned commit, minus the turbo
153
+ LoRA (not in the cached set) and the audio decode (narration is the shell's, never the clip's).
154
+ """
155
+ request = api_graph["request"]
156
+ models = api_graph["models"]
157
+ # Loaders resolve names inside models/<kind>/, so they take the basename, not the cache path.
158
+ name = lambda key: Path(models[key]).name # noqa: E731
159
+ return {
160
+ "1": {"class_type": "UNETLoader", "inputs": {"unet_name": name("diffusion"), "weight_dtype": "default"}},
161
+ "2": {
162
+ "class_type": "CLIPLoader",
163
+ "inputs": {"clip_name": name("textEncoder"), "type": "minimax", "device": "default"},
164
+ },
165
+ "3": {"class_type": "VAELoader", "inputs": {"vae_name": name("videoVae")}},
166
+ "4": {"class_type": "LoadImage", "inputs": {"image": first_frame_name}},
167
+ "5": {
168
+ "class_type": "MiniMaxH3ImageToVideo",
169
+ "inputs": {
170
+ "clip": ["2", 0],
171
+ "vae": ["3", 0],
172
+ "prompt": request["prompt"],
173
+ "width": request["width"],
174
+ "height": request["height"],
175
+ "length": frames,
176
+ "first_frame": ["4", 0],
177
+ },
178
+ },
179
+ "6": {"class_type": "RandomNoise", "inputs": {"noise_seed": request["seed"]}},
180
+ "7": {"class_type": "KSamplerSelect", "inputs": {"sampler_name": request["sampler"]}},
181
+ "8": {
182
+ "class_type": "BasicScheduler",
183
+ "inputs": {"model": ["1", 0], "scheduler": request["scheduler"], "steps": request["steps"], "denoise": 1.0},
184
+ },
185
+ "9": {"class_type": "BasicGuider", "inputs": {"model": ["1", 0], "conditioning": ["5", 0]}},
186
+ "10": {
187
+ "class_type": "SamplerCustomAdvanced",
188
+ "inputs": {
189
+ "noise": ["6", 0],
190
+ "guider": ["9", 0],
191
+ "sampler": ["7", 0],
192
+ "sigmas": ["8", 0],
193
+ "latent_image": ["5", 1],
194
+ },
195
+ },
196
+ "11": {"class_type": "VAEDecode", "inputs": {"samples": ["10", 0], "vae": ["3", 0]}},
197
+ "12": {"class_type": "CreateVideo", "inputs": {"images": ["11", 0], "fps": request["fps"]}},
198
+ save_node: {
199
+ "class_type": "SaveVideo",
200
+ # SaveVideo's format/codec are nested DynamicCombos, addressed by dotted input keys.
201
+ "inputs": {
202
+ "video": ["12", 0],
203
+ "filename_prefix": api_graph["outputs"]["fileNamePrefix"],
204
+ "format": "mp4",
205
+ "format.codec": "h264",
206
+ },
207
+ },
208
+ }
209
+
210
+
211
+ def wait_for_output(prompt_id: str, deadline: float) -> dict:
212
+ while time.time() < deadline:
213
+ try:
214
+ history = http_json(f"{COMFYUI_URL}/history/{prompt_id}")
215
+ except (urllib.error.URLError, TimeoutError, ConnectionError):
216
+ time.sleep(POLL_INTERVAL_SEC)
217
+ continue
218
+ entry = history.get(prompt_id)
219
+ if entry is not None:
220
+ status = entry.get("status", {})
221
+ if status.get("status_str") == "error":
222
+ fail(f"ComfyUI reported an error for prompt {prompt_id}: {status.get('messages')}")
223
+ if status.get("completed") is True or status.get("status_str") == "success":
224
+ return entry
225
+ time.sleep(POLL_INTERVAL_SEC)
226
+ fail(f"ComfyUI produced no output for prompt {prompt_id} before the deadline")
227
+
228
+
229
+ def collect_artifact(entry: dict, api_graph: dict, out_path: Path) -> None:
230
+ """Copy exactly one expected clip; reject missing, unexpected or out-of-directory artifacts."""
231
+ accepted = tuple(api_graph["outputs"]["acceptedExtensions"])
232
+ prefix = api_graph["outputs"]["fileNamePrefix"]
233
+ expected_subfolder = str(Path(prefix).parent) if Path(prefix).parent != Path(".") else ""
234
+ candidates: list[Path] = []
235
+ for node_output in (entry.get("outputs") or {}).values():
236
+ for key in ("images", "videos", "gifs"):
237
+ for item in node_output.get(key) or []:
238
+ filename = item.get("filename") if isinstance(item, dict) else None
239
+ if not isinstance(filename, str) or not filename.endswith(accepted):
240
+ continue
241
+ if not filename.startswith(Path(prefix).name):
242
+ continue
243
+ # ComfyUI reports the prefix's directory as `subfolder`; anything else is not ours.
244
+ if item.get("subfolder", "") != expected_subfolder:
245
+ continue
246
+ candidates.append(Path(expected_subfolder, filename))
247
+ if len(candidates) != 1:
248
+ fail(f"expected exactly one {accepted} artifact from the H3 graph, got {len(candidates)}")
249
+ chosen = candidates[0]
250
+ if chosen.is_absolute() or ".." in chosen.parts:
251
+ fail(f"ComfyUI reported an artifact outside its output directory: {chosen}")
252
+ comfy_root = Path(os.environ.get("KK_COMFYUI_ROOT", "/content/ComfyUI"))
253
+ source = comfy_root / "output" / chosen
254
+ if not source.is_file():
255
+ fail(f"ComfyUI reported {chosen} but {source} does not exist")
256
+ shutil.copyfile(source, out_path)
257
+
258
+
259
+ def main(argv: list[str] | None = None) -> int:
260
+ parser = argparse.ArgumentParser(prog="colab_comfyui_h3", description=__doc__)
261
+ parser.add_argument("--first-frame", required=True)
262
+ parser.add_argument("--out-dir", required=True)
263
+ parser.add_argument("--frames", type=int, default=None)
264
+ parser.add_argument("--api-graph", default=str(support_dir() / "comfyui-h3-i2v-api.json"))
265
+ parser.add_argument("--deadline-sec", type=int, default=DEFAULT_DEADLINE_SEC)
266
+ args = parser.parse_args(list(argv) if argv is not None else None)
267
+
268
+ graph = load_graph(Path(args.api_graph))
269
+ # An explicit 0 is a refusal, not "use the default": the bound below is what catches it.
270
+ frames = int(graph["request"]["frames"]) if args.frames is None else args.frames
271
+ if frames < 1 or frames > 4 * int(graph["request"]["fps"]):
272
+ fail(f"frames must be between 1 and 4 seconds at {graph['request']['fps']} fps (got {frames})")
273
+ if (frames - 5) % 17 != 0:
274
+ # H3 snaps length up to its 17k+5 grid, so an off-grid count would silently render longer.
275
+ fail(f"frames must sit on the H3 17k+5 grid (5, 22, 39, 56, 73, 90; got {frames})")
276
+ first_frame = Path(args.first_frame)
277
+ if not first_frame.is_file() or first_frame.stat().st_size == 0:
278
+ fail(f"first frame {first_frame} is missing or empty")
279
+ out_dir = Path(args.out_dir)
280
+ out_dir.mkdir(parents=True, exist_ok=True)
281
+
282
+ deadline = time.time() + args.deadline_sec
283
+ cache_dir = models_dir()
284
+ receipt = restore_weights(graph, cache_dir)
285
+ process = start_comfyui(graph, deadline)
286
+ try:
287
+ info = http_json(f"{COMFYUI_URL}/object_info", timeout=30)
288
+ assert_nodes(info, graph["comfyui"]["requiredNodes"])
289
+ frame_name = stage_first_frame(first_frame, Path(os.environ.get("KK_COMFYUI_ROOT", "/content/ComfyUI")))
290
+ submitted = http_json(
291
+ f"{COMFYUI_URL}/prompt",
292
+ {"prompt": build_prompt(graph, frame_name, frames, graph["outputs"]["nodeId"]), "client_id": "kk-video"},
293
+ )
294
+ prompt_id = submitted.get("prompt_id")
295
+ if not isinstance(prompt_id, str) or prompt_id == "":
296
+ fail("ComfyUI accepted no prompt id")
297
+ entry = wait_for_output(prompt_id, deadline)
298
+ out_path = out_dir / "clip-0.mp4"
299
+ collect_artifact(entry, graph, out_path)
300
+ finally:
301
+ process.terminate()
302
+ print(
303
+ f"{WORKER_RESULT_MARKER}"
304
+ + json.dumps(
305
+ {
306
+ "cache": "drive",
307
+ "outputs": [str(out_path)],
308
+ "provider": "comfyui-minimax-h3",
309
+ "comfyuiCommit": graph["comfyui"]["commit"],
310
+ "comfyuiRuntimeCommit": runtime_commit(Path(os.environ.get("KK_COMFYUI_ROOT", "/content/ComfyUI"))),
311
+ "modelCache": {"verified": receipt.get("verified", False), "restored": len(receipt.get("restored", []))},
312
+ "frames": frames,
313
+ }
314
+ )
315
+ )
316
+ return 0
317
+
318
+
319
+ if __name__ == "__main__":
320
+ # The runner's argv contract is KK_COLAB_ARGS; inside the Colab kernel sys.argv is the kernel's own.
321
+ remote_args = os.environ.get("KK_COLAB_ARGS")
322
+ sys.exit(main(json.loads(remote_args) if remote_args is not None else None))
@@ -0,0 +1,47 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "graph": "minimax-h3-fl2va-i2v",
4
+ "comfyui": {
5
+ "commit": "5f0d863aa0c52425ff27d48747bc45f9ab83c454",
6
+ "repo": "Comfy-Org/ComfyUI",
7
+ "note": "Verified to ship comfy_extras/nodes_minimax_h3.py; the graph follows blueprints/Image to Video (MiniMax H3).json at this commit without the turbo LoRA or audio decode. Re-verify /object_info before bumping (0459 R1).",
8
+ "requiredNodes": [
9
+ "BasicGuider",
10
+ "BasicScheduler",
11
+ "CLIPLoader",
12
+ "CreateVideo",
13
+ "KSamplerSelect",
14
+ "LoadImage",
15
+ "MiniMaxH3ImageToVideo",
16
+ "RandomNoise",
17
+ "SamplerCustomAdvanced",
18
+ "SaveVideo",
19
+ "UNETLoader",
20
+ "VAEDecode",
21
+ "VAELoader"
22
+ ]
23
+ },
24
+ "request": {
25
+ "prompt": "subtle natural camera drift, subject stays centered, cinematic light, no text",
26
+ "frames": 73,
27
+ "fps": 24,
28
+ "width": 736,
29
+ "height": 416,
30
+ "steps": 20,
31
+ "sampler": "res_multistep",
32
+ "scheduler": "simple",
33
+ "seed": 42
34
+ },
35
+ "models": {
36
+ "diffusion": "diffusion_models/minimax_h3_fl2va_pruned_int8_convrot.safetensors",
37
+ "textEncoder": "text_encoders/qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors",
38
+ "videoVae": "vae/minimax_h3_video_vae_int8_convrot.safetensors",
39
+ "audioVae": "vae/minimax_h3_audio_vae_fp32.safetensors",
40
+ "manifest": "comfyui-h3-models.json"
41
+ },
42
+ "outputs": {
43
+ "nodeId": "save",
44
+ "fileNamePrefix": "kk-h3/clip",
45
+ "acceptedExtensions": [".mp4"]
46
+ }
47
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "group": "MiniMax H3 FL2VA",
4
+ "repo": "Comfy-Org/MiniMax-H3",
5
+ "revision": "4b53a35191437de05370da548e59aeabe2a5a09a",
6
+ "models": [
7
+ {
8
+ "relativePath": "diffusion_models/minimax_h3_fl2va_pruned_int8_convrot.safetensors",
9
+ "remote": "diffusion_models/minimax_h3_fl2va_pruned_int8_convrot.safetensors",
10
+ "bytes": 20970379616,
11
+ "sha256": "e889202c41dafb67b10d67b97f0d8541508036a6090af23425a5c2615d03c47a"
12
+ },
13
+ {
14
+ "relativePath": "text_encoders/qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors",
15
+ "remote": "text_encoders/qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors",
16
+ "bytes": 15687142551,
17
+ "sha256": "35a88d51044231fe332301d7a62aa81e3f2cba62febeb446e2c1e3e0ef76f2c6"
18
+ },
19
+ {
20
+ "relativePath": "vae/minimax_h3_video_vae_int8_convrot.safetensors",
21
+ "remote": "vae/minimax_h3_video_vae_int8_convrot.safetensors",
22
+ "bytes": 2811065184,
23
+ "sha256": "52a2c8c73583c86e4f41cdcce3a6ad0ea562987bc0bf3d60a0cef5f5c8e60c0e"
24
+ },
25
+ {
26
+ "relativePath": "vae/minimax_h3_audio_vae_fp32.safetensors",
27
+ "remote": "vae/minimax_h3_audio_vae_fp32.safetensors",
28
+ "bytes": 605254808,
29
+ "sha256": "8e505d95dd1561d47abd43d4238fd40d9bb1ae9e147ed0a4cba778d76ae4db48"
30
+ }
31
+ ]
32
+ }