Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"en": "Automated video editing toolkit: standard cloud speech transcription and synthesis, full video frame extraction and understanding, local re-inspection, timeline, preview rendering, QC, and TTS.",
"zh-CN": "自动化视频剪辑工具包: 标准云端语音转录与合成、完整视频抽帧理解、局部复看、时间线、预览渲染、QC 和 TTS。"
},
"version": "0.4.3",
"version": "0.4.5",
"author": {
"name": "Z.ai",
"url": "https://z.ai"
Expand Down
5 changes: 3 additions & 2 deletions plugins/video-agent-kit/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "video-agent-kit",
"version": "0.4.3",
"version": "0.4.5",
"description": "自动化视频剪辑工具包: 标准云端语音转录与合成、完整视频抽帧理解、局部复看、时间线、预览渲染、QC 和 TTS。",
"author": {
"name": "Z.ai",
Expand Down Expand Up @@ -47,8 +47,9 @@
"mcpServers": {
"video-edit": {
"type": "stdio",
"command": "python3",
"command": "node",
"args": [
"${CLAUDE_PLUGIN_ROOT}/hooks/run_python.mjs",
"${CLAUDE_PLUGIN_ROOT}/mcp/video_edit_server.py"
],
"cwd": "${CLAUDE_PROJECT_DIR}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/video-agent-kit/.mcp.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"mcpServers": {
"video-edit": {
"type": "stdio",
"command": "python3",
"command": "node",
"args": [
"${CLAUDE_PLUGIN_ROOT}/hooks/run_python.mjs",
"${CLAUDE_PLUGIN_ROOT}/mcp/video_edit_server.py"
],
"cwd": "${CLAUDE_PROJECT_DIR}",
Expand Down
5 changes: 3 additions & 2 deletions plugins/video-agent-kit/.zcode-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "video-agent-kit",
"version": "0.4.3",
"version": "0.4.5",
"description": "自动化视频剪辑工具包: 标准云端语音转录与合成、完整视频抽帧理解、局部复看、时间线、预览渲染、QC 和 TTS。",
"author": {
"name": "Z.ai",
Expand Down Expand Up @@ -35,8 +35,9 @@
"mcpServers": {
"video-edit": {
"type": "stdio",
"command": "python3",
"command": "node",
"args": [
"${CLAUDE_PLUGIN_ROOT}/hooks/run_python.mjs",
"${CLAUDE_PLUGIN_ROOT}/mcp/video_edit_server.py"
],
"cwd": "${CLAUDE_PROJECT_DIR}",
Expand Down
8 changes: 7 additions & 1 deletion plugins/video-agent-kit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ skills/video-recap-workflows/SKILL.md
处理完整电影/赛事/比赛回放的解说剪辑;`env-setup` 只管环境(体检 + 装依赖,
跨 macOS / Windows / Linux),不碰剪辑任务。

首次使用前装环境(推荐走体检脚本,它跨 macOS / Windows / Linux 且默认用国内镜像):
首次使用前装环境(推荐走体检脚本,它跨 macOS / Windows / Linux 且默认用国内镜像)。运行插件 Hook 和 `video-edit` MCP server 的前置条件是:宿主环境中可从 `PATH` 解析到 `node`,并安装 Python 3.10+:

```bash
# 只体检:逐项报"要什么 / 缺了挂哪个能力 / 本平台怎么装"
Expand All @@ -68,6 +68,12 @@ python3 video-agent-kit/skills/env-setup/scripts/env_doctor.py --fix
真覆盖中文(`fc-match` 对着没装的中文族会返回 DejaVu,烧出来是豆腐块而 ffmpeg
退出码 0)、以及语音走的是哪条通道(在 ZCode 里就是"官方通道,本地无需 key",不会催你配凭据)。

Hook 和 `video-edit` MCP server 通过插件内置的 `hooks/run_python.mjs` 启动 Python,
不会把宿主平台固定为 `python3`:Windows 优先使用 `py -3` / `python`,macOS、Linux
优先使用 `python3` / `python`。入口命令使用宿主环境中位于 `PATH` 的 `node`;ZCode
不会为第三方插件提供独立的 Node.js。请确保 Node.js 和 Python 3.10+ 都已安装。解析器
只在解释器不存在时尝试下一个候选,脚本本身的退出码会原样返回。

也可以手工只装 Python 依赖(注意 `scenedetect` 必须 `--no-deps`,否则会把 GUI 版
opencv 盖到 `opencv-python-headless` 的 `cv2` 上,两个包一起坏):

Expand Down
6 changes: 3 additions & 3 deletions plugins/video-agent-kit/hooks/hooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"hooks": [
{
"type": "command",
"command": "python3 \"${CLAUDE_PLUGIN_ROOT}/hooks/env_check.py\"",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/run_python.mjs\" \"${CLAUDE_PLUGIN_ROOT}/hooks/env_check.py\"",
"timeout": 30,
"statusMessage": "video-agent-kit environment check..."
}
Expand All @@ -18,7 +18,7 @@
"hooks": [
{
"type": "command",
"command": "python3 \"${CLAUDE_PLUGIN_ROOT}/hooks/check_video_input.py\"",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/run_python.mjs\" \"${CLAUDE_PLUGIN_ROOT}/hooks/check_video_input.py\"",
"timeout": 15
}
]
Expand All @@ -29,7 +29,7 @@
"hooks": [
{
"type": "command",
"command": "python3 \"${CLAUDE_PLUGIN_ROOT}/hooks/check_closeout.py\"",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/run_python.mjs\" \"${CLAUDE_PLUGIN_ROOT}/hooks/check_closeout.py\"",
"timeout": 15
}
]
Expand Down
62 changes: 62 additions & 0 deletions plugins/video-agent-kit/hooks/run_python.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env node
/**
* Run a plugin Python entrypoint with the interpreter names used by each OS.
*
* Python's Windows launcher is preferred there because the official installer
* does not create a `python3` command. The first interpreter that exists is
* used; a real script failure is returned unchanged instead of being retried
* with another interpreter.
*/

import { spawnSync } from "node:child_process";

const [script, ...scriptArgs] = process.argv.slice(2);

if (!script) {
process.stderr.write("Usage: run_python.mjs <script> [...args]\n");
process.exit(2);
}

const candidates =
process.platform === "win32"
? [
["py", ["-3"]],
["python", []],
["python3", []],
]
: [
["python3", []],
["python", []],
];

for (const [command, prefixArgs] of candidates) {
let result;
try {
result = spawnSync(command, [...prefixArgs, script, ...scriptArgs], {
env: process.env,
stdio: "inherit",
});
} catch (error) {
if (error?.code === "ENOENT") continue;
process.stderr.write(`[video-agent-kit] failed to start ${command}: ${error}\n`);
process.exit(1);
}

if (result.error?.code === "ENOENT") continue;
if (result.error) {
process.stderr.write(`[video-agent-kit] failed to start ${command}: ${result.error}\n`);
process.exit(1);
}

if (result.signal) {
process.stderr.write(`[video-agent-kit] ${command} exited via ${result.signal}\n`);
process.exit(1);
}

process.exit(result.status ?? 1);
}

process.stderr.write(
"[video-agent-kit] Python 3.10+ was not found; install Python and retry.\n",
);
process.exit(127);