@remixmate/cli 0.1.2 → 0.9.5
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.
- package/README.md +46 -0
- package/README.zh-CN.md +22 -0
- package/dist/auth/auth-lock.d.ts +26 -0
- package/dist/auth/auth-lock.js +100 -0
- package/dist/auth/auto-login.d.ts +20 -0
- package/dist/auth/auto-login.js +66 -0
- package/dist/auth/commands.d.ts +8 -0
- package/dist/auth/commands.js +130 -0
- package/dist/auth/credential-store.d.ts +44 -0
- package/dist/auth/credential-store.js +126 -0
- package/dist/auth/device-flow-runner.d.ts +43 -0
- package/dist/auth/device-flow-runner.js +62 -0
- package/dist/auth/device-flow.d.ts +52 -0
- package/dist/auth/device-flow.js +115 -0
- package/dist/auth/environment.d.ts +25 -0
- package/dist/auth/environment.js +48 -0
- package/dist/auth/resolve.d.ts +30 -0
- package/dist/auth/resolve.js +44 -0
- package/dist/cli.js +11 -0
- package/dist/handlers/gen-digital-human.js +1 -1
- package/dist/handlers/gen-image.js +1 -1
- package/dist/handlers/gen-video.js +1 -1
- package/dist/handlers/gen-voice.js +2 -2
- package/dist/http.d.ts +9 -5
- package/dist/http.js +24 -10
- package/dist/manifest.json +3 -3
- package/dist/runner.d.ts +1 -1
- package/package.json +1 -1
- package/skills/export-jianying/SKILL.md +9 -3
- package/skills/export-jianying/version.json +1 -1
- package/skills/gen-digital-human/SKILL.md +11 -11
- package/skills/gen-digital-human/version.json +1 -1
- package/skills/gen-image/SKILL.md +6 -6
- package/skills/gen-image/version.json +1 -1
- package/skills/gen-script/scripts/gen_script.py +211 -140
- package/skills/gen-script/skill.json +1 -1
- package/skills/gen-script/version.json +1 -1
- package/skills/gen-video/SKILL.md +6 -6
- package/skills/gen-video/version.json +1 -1
- package/skills/gen-voice/SKILL.md +6 -6
- package/skills/gen-voice/version.json +1 -1
- package/skills/render-video/SKILL.md +20 -1
- package/skills/render-video/scripts/remote_renderer_client.py +9 -7
- package/skills/render-video/scripts/render_video.py +119 -15
- package/skills/render-video/version.json +1 -1
- package/skills/template-registry/README.md +12 -13
- package/skills/template-registry/SKILL.md +11 -12
- package/skills/template-registry/scripts/registry_loader.py +117 -96
- package/skills/template-registry/scripts/render_job_client.py +12 -0
- package/skills/template-registry/skill.json +1 -1
- package/skills/template-registry/version.json +1 -1
- package/skills/template-registry/video_dsl/runtime/dsl_validator.py +2 -2
- package/skills/web-capture/skill.json +0 -1
- package/skills/web-capture/version.json +1 -1
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"skillName": "gen-voice",
|
|
3
3
|
"repoName": "agent-skill-media-maker",
|
|
4
4
|
"skillId": "338",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "V7",
|
|
6
6
|
"skillDescription": "语音合成(TTS)技能,将文字转为语音音频(调用 ab-api /tool/minimaxT2aV2,基于 Minimax TTS)。\n\n当用户提到以下任何需求时,立即使用本 skill:\n- AI 配音、语音合成、文字转语音、TTS、文本转音频、生成语音\n- 使用 minimax 语音合成\n- 用户想要将一段文字朗读出来、生成音频\n\n即使用户没有明确说「使用 AI」,只要他们想要将文字转为语音,也要使用本 skill。"
|
|
7
7
|
}
|
|
@@ -73,9 +73,28 @@ python3 <SkillDir>/scripts/render_video.py --job-id <jobId>
|
|
|
73
73
|
When the DB is unavailable, the script accepts a pre-generated RenderPlan file:
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
-
python3 <SkillDir>/scripts/render_video.py --render-plan
|
|
76
|
+
python3 <SkillDir>/scripts/render_video.py --render-plan <path>.render-plan.json
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
+
> ⚠️ **Do NOT blindly point `--render-plan` at a shared `output/render-plan.json`.**
|
|
80
|
+
> Under the default token-present path, `prepare_video_assets` / `render_video`
|
|
81
|
+
> persist the plan to the **database (jobId)** only — they do **not** write
|
|
82
|
+
> `output/render-plan.json`. Any file sitting there is likely a leftover from a
|
|
83
|
+
> previous, unrelated run (the `output/` dir is gitignored scratch), and rendering
|
|
84
|
+
> it silently produces the wrong video.
|
|
85
|
+
>
|
|
86
|
+
> To get a RenderPlan file on disk, generate it explicitly:
|
|
87
|
+
> ```bash
|
|
88
|
+
> python3 <SkillDir>/scripts/render_video.py --dsl video.dsl.json --template-id <id> \
|
|
89
|
+
> --resolve-only --save-render-plan --render-plan-output video.render-plan.json
|
|
90
|
+
> ```
|
|
91
|
+
> Or skip the file entirely and render in one shot:
|
|
92
|
+
> `render_video.py --dsl video.dsl.json --template-id <id>`.
|
|
93
|
+
>
|
|
94
|
+
> On load, the script now prints a `↳ plan: templateId=… composition=… duration=… title=…`
|
|
95
|
+
> summary, and warns if the plan file is older than a `--dsl` you also passed —
|
|
96
|
+
> check that line matches what you intend before the render proceeds.
|
|
97
|
+
|
|
79
98
|
### Render and upload to Alibaba Cloud OSS (default behavior)
|
|
80
99
|
|
|
81
100
|
```bash
|
|
@@ -121,11 +121,12 @@ def start_render(
|
|
|
121
121
|
base_url: Optional[str] = None,
|
|
122
122
|
timeout: float = 120.0,
|
|
123
123
|
conversation_id: Optional[str] = None,
|
|
124
|
+
path: str = "/render",
|
|
124
125
|
) -> str:
|
|
125
|
-
"""POST /render
|
|
126
|
+
"""POST <path>(默认 /render,私有模板动态渲染传 /renderDraft);返回 taskId。"""
|
|
126
127
|
result = _request(
|
|
127
128
|
"POST",
|
|
128
|
-
|
|
129
|
+
path,
|
|
129
130
|
private_token=private_token,
|
|
130
131
|
payload=payload,
|
|
131
132
|
base_url=base_url,
|
|
@@ -135,7 +136,7 @@ def start_render(
|
|
|
135
136
|
data = _check_code(result)
|
|
136
137
|
task_id = data.get("taskId")
|
|
137
138
|
if not task_id:
|
|
138
|
-
raise RemoteRenderError(f"
|
|
139
|
+
raise RemoteRenderError(f"{path} did not return a taskId: {result}")
|
|
139
140
|
return str(task_id)
|
|
140
141
|
|
|
141
142
|
|
|
@@ -150,8 +151,9 @@ def poll_render(
|
|
|
150
151
|
max_consecutive_errors: int = 5,
|
|
151
152
|
on_progress: Optional[Callable[[dict], None]] = None,
|
|
152
153
|
adaptive_interval: bool = False,
|
|
154
|
+
status_path: str = "/renderStatus",
|
|
153
155
|
) -> dict:
|
|
154
|
-
"""POST /renderStatus
|
|
156
|
+
"""POST <status_path>(默认 /renderStatus,私有模板传 /renderDraftStatus)轮询直到完成/失败/超时。
|
|
155
157
|
|
|
156
158
|
成功时返回 data dict(至少包含 fileUrl),否则抛 RemoteRenderError。
|
|
157
159
|
on_progress 回调在每次成功请求后触发,参数为完整 data dict。
|
|
@@ -170,13 +172,13 @@ def poll_render(
|
|
|
170
172
|
if elapsed > timeout:
|
|
171
173
|
raise RemoteRenderError(
|
|
172
174
|
f"remote render polling timed out (waited {elapsed:.0f}s, taskId={task_id}); "
|
|
173
|
-
f"the job may still be running on the backend — query
|
|
175
|
+
f"the job may still be running on the backend — query {status_path} later"
|
|
174
176
|
)
|
|
175
177
|
|
|
176
178
|
try:
|
|
177
179
|
result = _request(
|
|
178
180
|
"POST",
|
|
179
|
-
|
|
181
|
+
status_path,
|
|
180
182
|
private_token=private_token,
|
|
181
183
|
payload={"taskId": task_id},
|
|
182
184
|
base_url=base_url,
|
|
@@ -201,7 +203,7 @@ def poll_render(
|
|
|
201
203
|
body = exc.read().decode("utf-8")
|
|
202
204
|
except Exception:
|
|
203
205
|
pass
|
|
204
|
-
raise RemoteRenderError(f"HTTP {exc.code}
|
|
206
|
+
raise RemoteRenderError(f"HTTP {exc.code} {status_path}: {body[:200]}") from exc
|
|
205
207
|
|
|
206
208
|
consecutive_errors = 0
|
|
207
209
|
|
|
@@ -1607,26 +1607,73 @@ def render_with_remote_api(
|
|
|
1607
1607
|
template_id = render_plan.get("templateId", "")
|
|
1608
1608
|
cover_composition_id = resolve_cover_composition_id(template_id)
|
|
1609
1609
|
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1610
|
+
# ─── 私有模板路由 ────────────────────────────────────────────────────
|
|
1611
|
+
# 仅【用户私有模板】(isBuiltin=false 且带 sourceOssKey) 源码在 OSS、不在
|
|
1612
|
+
# ab-render 启动 bundle,需走动态渲染:presignSource 取临时 GET URL → /renderDraft。
|
|
1613
|
+
# 内置模板即使带 sourceOssKey(builtin-template-registry 回填,仅服务
|
|
1614
|
+
# derive_template 派生),渲染仍走 ab-render 预构建的 /render,绝不走 /renderDraft,
|
|
1615
|
+
# 否则会用 OSS 上的旧快照 + DraftMainVideo 复刻渲染,与生产 MainVideo 漂移。
|
|
1616
|
+
source_oss_key = None
|
|
1617
|
+
template_id = render_plan.get("templateId", "")
|
|
1618
|
+
if template_id:
|
|
1619
|
+
try:
|
|
1620
|
+
from registry_loader import get_template # type: ignore
|
|
1621
|
+
_meta = get_template(template_id)
|
|
1622
|
+
if _meta and not _meta.get("isBuiltin"):
|
|
1623
|
+
source_oss_key = _meta.get("sourceOssKey")
|
|
1624
|
+
except Exception:
|
|
1625
|
+
source_oss_key = None
|
|
1626
|
+
|
|
1627
|
+
if source_oss_key:
|
|
1628
|
+
import render_job_client # type: ignore
|
|
1629
|
+
try:
|
|
1630
|
+
src = render_job_client.presign_template_source(template_id, private_token)
|
|
1631
|
+
tarball_url = src.get("tarballUrl")
|
|
1632
|
+
if not tarball_url:
|
|
1633
|
+
raise RuntimeError(f"presignSource 未返回 tarballUrl: {src}")
|
|
1634
|
+
except Exception as exc:
|
|
1635
|
+
LogPrint(f"❌ presignSource failed for private template {template_id}: {exc}", file=sys.stderr)
|
|
1636
|
+
render_plan["status"] = "failed"
|
|
1637
|
+
render_plan["errors"].append({
|
|
1638
|
+
"phase": "render",
|
|
1639
|
+
"message": f"presignSource failed: {exc}",
|
|
1640
|
+
"timestamp": now_iso(),
|
|
1641
|
+
})
|
|
1642
|
+
return False
|
|
1643
|
+
payload = {
|
|
1644
|
+
"tarballUrl": tarball_url,
|
|
1645
|
+
"inputProps": input_props,
|
|
1646
|
+
"upload": True,
|
|
1647
|
+
"uploadTitle": effective_title,
|
|
1648
|
+
}
|
|
1649
|
+
render_path = "/renderDraft"
|
|
1650
|
+
status_path = "/renderDraftStatus"
|
|
1651
|
+
else:
|
|
1652
|
+
payload = {
|
|
1653
|
+
"compositionId": composition_id,
|
|
1654
|
+
"renderConfig": config,
|
|
1655
|
+
"inputProps": input_props,
|
|
1656
|
+
"uploadTitle": effective_title,
|
|
1657
|
+
}
|
|
1658
|
+
if cover_composition_id:
|
|
1659
|
+
payload["coverCompositionId"] = cover_composition_id
|
|
1660
|
+
render_path = "/render"
|
|
1661
|
+
status_path = "/renderStatus"
|
|
1618
1662
|
|
|
1619
1663
|
total_frames = config.get("totalFrames", 0)
|
|
1620
1664
|
LogPrint(f"🎬 Submitting remote render task...", file=sys.stderr)
|
|
1621
|
-
|
|
1622
|
-
|
|
1665
|
+
if source_oss_key:
|
|
1666
|
+
LogPrint(f" Private template (OSS dynamic bundle): {template_id}", file=sys.stderr)
|
|
1667
|
+
else:
|
|
1668
|
+
LogPrint(f" Composition: {composition_id}", file=sys.stderr)
|
|
1669
|
+
if cover_composition_id and not source_oss_key:
|
|
1623
1670
|
LogPrint(f" Cover: {cover_composition_id}", file=sys.stderr)
|
|
1624
1671
|
LogPrint(f" size: {config.get('width')}x{config.get('height')}", file=sys.stderr)
|
|
1625
1672
|
LogPrint(f" total frames: {total_frames}", file=sys.stderr)
|
|
1626
1673
|
sys.stderr.flush()
|
|
1627
1674
|
|
|
1628
1675
|
try:
|
|
1629
|
-
task_id = remote_renderer_client.start_render(payload, private_token=private_token, conversation_id=conversation_id)
|
|
1676
|
+
task_id = remote_renderer_client.start_render(payload, private_token=private_token, conversation_id=conversation_id, path=render_path)
|
|
1630
1677
|
except Exception as exc:
|
|
1631
1678
|
LogPrint(f"❌ remote render submission failed: {exc}", file=sys.stderr)
|
|
1632
1679
|
render_plan["status"] = "failed"
|
|
@@ -1686,6 +1733,7 @@ def render_with_remote_api(
|
|
|
1686
1733
|
interval=poll_interval,
|
|
1687
1734
|
on_progress=_on_progress,
|
|
1688
1735
|
adaptive_interval=True,
|
|
1736
|
+
status_path=status_path,
|
|
1689
1737
|
)
|
|
1690
1738
|
except Exception as exc:
|
|
1691
1739
|
LogPrint(f"❌ remote render polling failed: {exc}", file=sys.stderr)
|
|
@@ -1808,6 +1856,35 @@ def auto_bind_template(dsl: dict, template_id: str) -> dict:
|
|
|
1808
1856
|
return binding
|
|
1809
1857
|
|
|
1810
1858
|
|
|
1859
|
+
def _log_render_plan_summary(render_plan: dict) -> None:
|
|
1860
|
+
"""Print a one-line identity summary of a loaded RenderPlan.
|
|
1861
|
+
|
|
1862
|
+
The two ways to feed an existing plan (``--render-plan <file>`` and
|
|
1863
|
+
``--job-id <int>``) used to print only the *source* (path / id), never the
|
|
1864
|
+
*content*. When a stale ``output/render-plan.json`` from a previous, unrelated
|
|
1865
|
+
run got picked up, the mismatch was rendered silently. Surfacing
|
|
1866
|
+
templateId / title / duration / scene count here makes a wrong plan obvious
|
|
1867
|
+
at a glance before any render time is spent.
|
|
1868
|
+
"""
|
|
1869
|
+
try:
|
|
1870
|
+
template_id = render_plan.get("templateId", "?")
|
|
1871
|
+
title = render_plan.get("title", "")
|
|
1872
|
+
cfg = render_plan.get("renderConfig", {}) or {}
|
|
1873
|
+
fps = cfg.get("fps") or 30
|
|
1874
|
+
total_frames = cfg.get("totalFrames")
|
|
1875
|
+
scenes = len(render_plan.get("timeline", []) or [])
|
|
1876
|
+
comp = (render_plan.get("remotionProps", {}) or {}).get("compositionId", "?")
|
|
1877
|
+
dur = f"{total_frames / fps:.1f}s/{total_frames}f" if total_frames else "?"
|
|
1878
|
+
LogPrint(
|
|
1879
|
+
f" ↳ plan: templateId={template_id} composition={comp} "
|
|
1880
|
+
f"duration={dur} scenes={scenes}" + (f' title=\"{title}\"' if title else ""),
|
|
1881
|
+
file=sys.stderr,
|
|
1882
|
+
)
|
|
1883
|
+
except Exception:
|
|
1884
|
+
# A summary is a convenience, never a hard dependency of rendering.
|
|
1885
|
+
pass
|
|
1886
|
+
|
|
1887
|
+
|
|
1811
1888
|
def main():
|
|
1812
1889
|
parser = argparse.ArgumentParser(
|
|
1813
1890
|
description="Video render tool — DSL + TemplateBinding → Remotion video.",
|
|
@@ -1896,21 +1973,48 @@ Examples:
|
|
|
1896
1973
|
sys.exit(1)
|
|
1897
1974
|
render_plan = json.loads(render_plan_str)
|
|
1898
1975
|
LogPrint(f"✅ RenderPlan loaded (jobId={args.job_id})", file=sys.stderr)
|
|
1976
|
+
_log_render_plan_summary(render_plan)
|
|
1899
1977
|
elif args.render_plan:
|
|
1900
1978
|
if not os.path.exists(args.render_plan):
|
|
1901
1979
|
LogPrint(f"❌ file does not exist: {args.render_plan}", file=sys.stderr)
|
|
1902
1980
|
sys.exit(1)
|
|
1903
1981
|
render_plan = load_json(args.render_plan)
|
|
1904
1982
|
LogPrint(f"📋 loaded existing RenderPlan: {args.render_plan}", file=sys.stderr)
|
|
1983
|
+
_log_render_plan_summary(render_plan)
|
|
1984
|
+
# 陈旧文件防护:output/render-plan.json 等共享文件名常被上一次别的项目
|
|
1985
|
+
# 的运行残留覆盖(output/ 是 gitignored 调试目录)。当用户同时给了 --dsl
|
|
1986
|
+
# 用以表明"我想渲这个 DSL",但磁盘上的 plan 比 DSL 还旧时,几乎可以肯定
|
|
1987
|
+
# 加载到的是过期 plan —— 明确警告而不是静默渲染错的东西。
|
|
1988
|
+
if args.dsl and os.path.exists(args.dsl):
|
|
1989
|
+
try:
|
|
1990
|
+
if os.path.getmtime(args.render_plan) < os.path.getmtime(args.dsl):
|
|
1991
|
+
LogPrint(
|
|
1992
|
+
f"⚠️ STALE RenderPlan? '{args.render_plan}' is OLDER than the DSL "
|
|
1993
|
+
f"'{args.dsl}'. You may be rendering a leftover plan from a previous "
|
|
1994
|
+
"run. Regenerate with --dsl ... --template-id ... (drop --render-plan) "
|
|
1995
|
+
"if the summary above doesn't match what you expect.",
|
|
1996
|
+
file=sys.stderr,
|
|
1997
|
+
)
|
|
1998
|
+
except OSError:
|
|
1999
|
+
pass
|
|
1905
2000
|
else:
|
|
1906
2001
|
if not args.dsl and not args.dsl_json:
|
|
1907
|
-
LogPrint(
|
|
1908
|
-
|
|
2002
|
+
LogPrint(
|
|
2003
|
+
"❌ render_video needs a DSL source. You provided neither --dsl/--dsl-json "
|
|
2004
|
+
"nor --render-plan/--job-id.\n"
|
|
2005
|
+
" Typical flow: 1) gen_script → DSL skeleton 2) prepare_video_assets "
|
|
2006
|
+
"(returns a job_id) 3) render_video with job_id=<int>.\n"
|
|
2007
|
+
" Or pass the DSL inline: render_video --dsl-json '<json>' --template-id <id>.",
|
|
2008
|
+
file=sys.stderr,
|
|
2009
|
+
)
|
|
1909
2010
|
sys.exit(1)
|
|
1910
2011
|
|
|
1911
2012
|
if not args.template_id:
|
|
1912
|
-
LogPrint(
|
|
1913
|
-
|
|
2013
|
+
LogPrint(
|
|
2014
|
+
"❌ render_video needs --template-id when rendering from --dsl/--dsl-json "
|
|
2015
|
+
"(binding is computed in-memory from the template id; --binding is no longer supported).",
|
|
2016
|
+
file=sys.stderr,
|
|
2017
|
+
)
|
|
1914
2018
|
sys.exit(1)
|
|
1915
2019
|
|
|
1916
2020
|
# 解析 DSL:优先 --dsl-json(inline),其次 --dsl(文件路径)
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"skillName": "render-video",
|
|
3
3
|
"repoName": "agent-skill-media-maker",
|
|
4
4
|
"skillId": "473",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "V19",
|
|
6
6
|
"skillDescription": "Final-render skill (Phase 3 of the two-phase video pipeline). Loads a persisted RenderPlan by job_id and drives Remotion to produce the final video. Assets must already be generated via prepare_video_assets."
|
|
7
7
|
}
|
|
@@ -4,30 +4,29 @@ CLI 暴露面是「列出可用模板」(`--list-templates`)。把 Video DSL 场
|
|
|
4
4
|
|
|
5
5
|
## 模板数据来源
|
|
6
6
|
|
|
7
|
-
模板元数据维护在独立仓库 **template-library
|
|
7
|
+
模板元数据维护在独立仓库 **template-library**,发布到 ab-api,运行时由本 skill 通过 `scripts/registry_loader.py` 从 **单一数据源(ab-api HTTP)** 加载:
|
|
8
8
|
|
|
9
|
-
|
|
|
10
|
-
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
9
|
+
| 来源 | 触发条件 | 适用场景 |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| 显式 `VIDEO_TEMPLATE_REGISTRY_URL`(ab-api 接口) | 环境变量非空 + `PRIV_TOKEN` 有效 | 指定后端 |
|
|
12
|
+
| 派生默认 URL `<MM_API_BASE_URL>/remotionTemplate/registry` | `VIDEO_TEMPLATE_REGISTRY_URL` 未设置 | 默认(含独立安装 codex / `npm i -g`,默认 `http://localhost:2999/api`) |
|
|
13
|
+
|
|
14
|
+
只从 ab-api 取数,是为了避免「本地文件 / monorepo 源码 / 数据库」多源并存导致的不一致——私有 / 多租户模板只存在于 ab-api,本地源永远不全。默认 URL **内置在 remixmate-cli 自身**(按 CLI 后端约定 `MM_API_BASE_URL` 推导),不再依赖 ab-agent 等宿主在 spawn 时注入,独立运行即可找到 registry。指向你自己的 ab-api 只需设 `MM_API_BASE_URL`(或直接设 `VIDEO_TEMPLATE_REGISTRY_URL`)并配置 `PRIV_TOKEN`。
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
HTTP 拉取带磁盘缓存(TTL + ETag/304);瞬时故障时降级复用同一 URL 的上一份缓存(同源容错,非第二个数据源),无缓存则直接报错。
|
|
16
17
|
|
|
17
18
|
ab-api 响应包装格式 `{code, msg, data}` 由 `registry_loader._fetch_http` 透明拆封;静态 JSON endpoint 也支持(直接返回 registry 文档)。
|
|
18
19
|
|
|
19
|
-
> 早期文档曾描述本 skill 通过 `@ab-templates/metadata` npm
|
|
20
|
+
> 早期文档曾描述本 skill 通过 `@ab-templates/metadata` npm 包 / monorepo 文件消费 registry —— 这些本地来源已移除,运行时只走 ab-api HTTP。monorepo 文件仅供 `check_contracts.py` / `sync_registry.py` 等 monorepo-only 维护脚本使用。
|
|
20
21
|
|
|
21
22
|
## 新增模板工作流
|
|
22
23
|
|
|
23
|
-
新增模板**不需要改
|
|
24
|
+
新增模板**不需要改 remixmate / template-registry 代码**:
|
|
24
25
|
|
|
25
26
|
1. 在 template-library 仓库定义新模板(`template.json` + 组件代码)。
|
|
26
27
|
2. template-library CI 校验 schema + 契约。
|
|
27
28
|
3. 合并后 template-library 的发布流水线将新 registry 推到 ab-api。
|
|
28
|
-
4.
|
|
29
|
-
|
|
30
|
-
本地调试时可通过 `VIDEO_TEMPLATE_REGISTRY_PREFER_LOCAL=1` 让 template-library 的源码改动立即生效,不依赖发布周期。
|
|
29
|
+
4. remixmate 端无需更新——下一次 `--list-templates` 即可看到新模板。
|
|
31
30
|
|
|
32
31
|
## 契约一致性
|
|
33
32
|
|
|
@@ -45,7 +44,7 @@ python3 <SkillDir>/scripts/check_contracts.py
|
|
|
45
44
|
|
|
46
45
|
## 共享 Python 模块
|
|
47
46
|
|
|
48
|
-
`scripts/` 是
|
|
47
|
+
`scripts/` 是 remixmate 内**跨 skill 共享 Python 代码**的约定位置。当前住户:
|
|
49
48
|
|
|
50
49
|
| 模块 | 谁在用 | 作用 |
|
|
51
50
|
|---|---|---|
|
|
@@ -23,9 +23,9 @@ Stores every video-template definition, loads a template by **template-id**, and
|
|
|
23
23
|
|
|
24
24
|
## Template registry
|
|
25
25
|
|
|
26
|
-
Template metadata
|
|
26
|
+
Template metadata is authored in the standalone **template-library** monorepo, published to ab-api, and served to the CLI over HTTP. At runtime template-registry loads the registry from a single source — the ab-api endpoint (see the env table below) — which returns every template definition (full slotMapping, compositions, etc.) including the caller's private/tenant templates.
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
> The `template-library/packages/metadata/registry.json` file below is the authoring layout in the monorepo. It is **not** read at runtime anymore; only monorepo-only maintenance tooling (`check_contracts.py`, `sync_registry.py`) touches it directly.
|
|
29
29
|
|
|
30
30
|
```
|
|
31
31
|
template-library/packages/
|
|
@@ -62,22 +62,21 @@ The skill itself only reads the registry; whether a token is needed depends on t
|
|
|
62
62
|
|
|
63
63
|
| Env var | Description | Default |
|
|
64
64
|
|---------|-------------|---------|
|
|
65
|
-
| `VIDEO_TEMPLATE_REGISTRY_URL` | ab-api endpoint returning the registry (
|
|
66
|
-
| `
|
|
65
|
+
| `VIDEO_TEMPLATE_REGISTRY_URL` | ab-api endpoint returning the registry (the single source of truth). | derived from `MM_API_BASE_URL` |
|
|
66
|
+
| `MM_API_BASE_URL` | ab-api base URL the CLI talks to. When `VIDEO_TEMPLATE_REGISTRY_URL` is unset, the registry endpoint is derived as `<base>/remotionTemplate/registry`. | `http://localhost:2999/api` |
|
|
67
|
+
| `PRIV_TOKEN` | Sent as `X-Priv-Token` when hitting the registry endpoint. Falls back to `~/.config/remixmate/credentials.json`. | unset |
|
|
67
68
|
| `VIDEO_TEMPLATE_REGISTRY_HTTP_METHOD` | `POST` (default) or `GET`. POST shape matches ab-api `{code,msg,data}`. | `POST` |
|
|
68
|
-
| `VIDEO_TEMPLATE_REGISTRY` | Explicit local file path — bypasses HTTP/fallback entirely (CI / pinned debug). | unset |
|
|
69
|
-
| `VIDEO_TEMPLATE_REGISTRY_PREFER_LOCAL` | When `1`, monorepo `template-library/packages/metadata/registry.json` wins over HTTP. Defaults to HTTP-first. | unset |
|
|
70
69
|
|
|
71
|
-
Resolution
|
|
72
|
-
`
|
|
70
|
+
Resolution (single source — see `scripts/registry_loader.py` for the canonical implementation):
|
|
71
|
+
the registry is loaded **only** from the ab-api HTTP endpoint — explicit `VIDEO_TEMPLATE_REGISTRY_URL`, otherwise `<MM_API_BASE_URL>/remotionTemplate/registry` (default `http://localhost:2999/api/...`). There is no local-file / monorepo / PREFER_LOCAL fallback: those multi-source paths were removed to avoid registry skew (private/multi-tenant templates only exist on ab-api). On a transient HTTP failure the loader degrades to the on-disk cache of the same URL; with no cache it fails loud. A standalone install (Codex / `npm i -g`) just needs `MM_API_BASE_URL` (or `VIDEO_TEMPLATE_REGISTRY_URL`) pointed at your ab-api plus a valid `PRIV_TOKEN`.
|
|
73
72
|
|
|
74
73
|
## Steps
|
|
75
74
|
|
|
76
|
-
> This skill is a Python skill of the
|
|
75
|
+
> This skill is a Python skill of the remixmate CLI (`entry.type: python` → `scripts/list_templates.py`). The agent tool name `template_registry` is the only entry; locally reproduce via `remixmate template-registry --list-templates`. The list command delegates to `scripts/registry_loader.py` — the same loader (with caching + stable/beta gating) that `render-video` and `gen-script` import in-process, so there is a single registry-reading implementation.
|
|
77
76
|
>
|
|
78
77
|
> The Python binding logic that maps DSL → TemplateBinding lives in `scripts/match_template.py` but is **not exposed as a CLI** — it is only consumed as a Python library by `render-video`'s `render_video.py` via `import match_template`.
|
|
79
78
|
|
|
80
|
-
1. **List available templates**: run `
|
|
79
|
+
1. **List available templates**: run `remixmate template-registry --list-templates` to view the templates in the registry along with their supported aspect ratios / style tags, and decide which `templateId` to pick.
|
|
81
80
|
2. **Write the DSL**: when generating the Video DSL, put the chosen `templateId` into `meta.templateId` (the canonical location). Use `meta.templateVariant` / `renderHints.templateVariant` to explicitly select a variant. The legacy `renderHints.templatePreference[0]` is still tolerated by `match_template.py` and `dsl_validator._pick_template_id` during transition, but new authors should write `meta.templateId`.
|
|
82
81
|
3. **Produce the TemplateBinding**: there is no standalone CLI for DSL → TemplateBinding; `prepare_video_assets` calls `match_template.build_binding(template, dsl)` inline during the asset-resolution pipeline and embeds the binding into the RenderPlan it hands to the renderer — no separate `*.binding.json` file is written.
|
|
83
82
|
|
|
@@ -86,7 +85,7 @@ Resolution order (see `scripts/registry_loader.py` for the canonical implementat
|
|
|
86
85
|
### List available templates
|
|
87
86
|
|
|
88
87
|
```bash
|
|
89
|
-
|
|
88
|
+
remixmate template-registry --list-templates
|
|
90
89
|
```
|
|
91
90
|
|
|
92
91
|
### Sync the registry cache (optional, used for offline / LLM prompt)
|
|
@@ -233,4 +232,4 @@ With `picture-book-en`, **narration reads English only, never Chinese**:
|
|
|
233
232
|
|
|
234
233
|
- **No template specified**: the DSL must set `meta.templateId` (or, for legacy DSLs only, `renderHints.templatePreference[0]`); otherwise `prepare_video_assets` refuses to build a binding and prints the list of available templates.
|
|
235
234
|
- **Malformed DSL**: validate first with `gen-script --validate` (delegates to `video_dsl.runtime.dsl_validator.validate_structural`).
|
|
236
|
-
- **Empty template registry**: confirm `VIDEO_TEMPLATE_REGISTRY_URL` is reachable
|
|
235
|
+
- **Empty template registry**: confirm the ab-api registry endpoint (`VIDEO_TEMPLATE_REGISTRY_URL`, or the one derived from `MM_API_BASE_URL`) is reachable and that `PRIV_TOKEN` is valid.
|