shizai-agent-mcp 0.5.2 → 0.5.4
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 +9 -9
- package/bin/shizai-agent-mcp.js +23 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,27 +5,27 @@
|
|
|
5
5
|
## 使用
|
|
6
6
|
|
|
7
7
|
```powershell
|
|
8
|
-
npx -y shizai-agent-mcp install
|
|
9
|
-
npx -y shizai-agent-mcp register codex
|
|
8
|
+
npx -y shizai-agent-mcp@latest install
|
|
9
|
+
npx -y shizai-agent-mcp@latest register codex
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
也可以注册 Cursor 或 Claude Desktop:
|
|
13
13
|
|
|
14
14
|
```powershell
|
|
15
|
-
npx -y shizai-agent-mcp register cursor
|
|
16
|
-
npx -y shizai-agent-mcp register claude
|
|
15
|
+
npx -y shizai-agent-mcp@latest register cursor
|
|
16
|
+
npx -y shizai-agent-mcp@latest register claude
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
常用命令:
|
|
20
20
|
|
|
21
21
|
```powershell
|
|
22
|
-
npx -y shizai-agent-mcp status
|
|
23
|
-
npx -y shizai-agent-mcp path
|
|
24
|
-
npx -y shizai-agent-mcp uninstall
|
|
22
|
+
npx -y shizai-agent-mcp@latest status
|
|
23
|
+
npx -y shizai-agent-mcp@latest path
|
|
24
|
+
npx -y shizai-agent-mcp@latest uninstall
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
当前 npm launcher 版本为 `0.5.
|
|
28
|
-
`shizai-agent-v0.7.
|
|
27
|
+
当前 npm launcher 版本为 `0.5.4`,默认下载最新的 `v0.7.27` Windows x64 资产:
|
|
28
|
+
`shizai-agent-v0.7.27-windows-x64.zip`。npm 包不附带浏览器自动化依赖,也不要求用户安装额外扩展。
|
|
29
29
|
|
|
30
30
|
`install` 覆盖文件后会自动注册 Codex MCP;需要跳过配置写入时使用
|
|
31
31
|
`install --skip-register`,之后可单独运行 `register codex`。
|
package/bin/shizai-agent-mcp.js
CHANGED
|
@@ -9,7 +9,7 @@ const { execFileSync, spawn } = require('node:child_process');
|
|
|
9
9
|
|
|
10
10
|
const SERVER = 'shizai-agent';
|
|
11
11
|
const REPO = process.env.SHIZAI_AGENT_REPO || 'yimoxzy/shizai-agent';
|
|
12
|
-
const DEFAULT_VERSION = process.env.SHIZAI_AGENT_VERSION || '0.7.
|
|
12
|
+
const DEFAULT_VERSION = process.env.SHIZAI_AGENT_VERSION || '0.7.27';
|
|
13
13
|
const installRoot = process.env.SHIZAI_AGENT_HOME || path.join(
|
|
14
14
|
process.env.LOCALAPPDATA || path.join(os.homedir(), '.local'), 'Programs', 'ShizaiAgent'
|
|
15
15
|
);
|
|
@@ -112,10 +112,22 @@ function verifySha256(file, expected) {
|
|
|
112
112
|
const actual = crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex').toLowerCase();
|
|
113
113
|
if (actual !== expected.toLowerCase()) throw new Error(`SHA256 校验失败:期望 ${expected},实际 ${actual}`);
|
|
114
114
|
}
|
|
115
|
-
function download(url, destination) {
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
function download(url, destination, options = {}) {
|
|
116
|
+
const progress = options.progress !== false;
|
|
117
|
+
const curl = process.env.SHIZAI_AGENT_CURL || 'curl.exe';
|
|
118
|
+
const args = ['--fail', '--location', '--silent', '--show-error'];
|
|
119
|
+
if (progress) args.push('--progress-bar');
|
|
120
|
+
args.push('--output', destination, url);
|
|
121
|
+
try {
|
|
122
|
+
execFileSync(curl, args, { stdio: ['ignore', 'ignore', 'inherit'] });
|
|
123
|
+
if (progress) process.stderr.write('\n');
|
|
124
|
+
return;
|
|
125
|
+
} catch (error) {
|
|
126
|
+
if (error?.code !== 'ENOENT') throw error;
|
|
127
|
+
}
|
|
128
|
+
const script = `Invoke-WebRequest -UseBasicParsing -Uri ${psQuote(url)} -OutFile ${psQuote(destination)} -ProgressAction SilentlyContinue`;
|
|
129
|
+
runPowerShell(script);
|
|
130
|
+
}
|
|
119
131
|
function install(version, options = {}) {
|
|
120
132
|
const destination = validateInstallRoot();
|
|
121
133
|
const asset = assetName(version);
|
|
@@ -130,10 +142,9 @@ function install(version, options = {}) {
|
|
|
130
142
|
let verified = false;
|
|
131
143
|
const stoppedProcesses = new Set();
|
|
132
144
|
try {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
download(`${url}.sha256`, checksum);
|
|
145
|
+
download(url, archive, { progress: true });
|
|
146
|
+
try {
|
|
147
|
+
download(`${url}.sha256`, checksum, { progress: false });
|
|
137
148
|
const text = fs.readFileSync(checksum, 'utf8');
|
|
138
149
|
const expected = (text.match(/[a-f0-9]{64}/i) || [])[0];
|
|
139
150
|
if (!expected) throw new Error('校验文件中没有 SHA-256');
|
|
@@ -191,8 +202,9 @@ function install(version, options = {}) {
|
|
|
191
202
|
cleanupInstallArtifacts(parent, [stage, backup]);
|
|
192
203
|
const result = { installed: true, version, directory: destination, command: binaryPath(), verified, stopped_processes: [...stoppedProcesses].sort((left, right) => left - right) };
|
|
193
204
|
if (!options.skipRegister) result.registration = registerCodex(true);
|
|
194
|
-
|
|
195
|
-
|
|
205
|
+
console.log(`安装成功:Shizai Agent MCP v${version}`);
|
|
206
|
+
if (result.registration?.registered) console.log('Codex MCP 已注册');
|
|
207
|
+
return result;
|
|
196
208
|
} finally {
|
|
197
209
|
removeDirectoryWithRetries(temp);
|
|
198
210
|
removeDirectoryWithRetries(stage);
|