shizai-agent-mcp 0.2.7 → 0.2.8
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 +4 -1
- package/bin/shizai-agent-mcp.js +10 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,8 +24,11 @@ npx -y shizai-agent-mcp path
|
|
|
24
24
|
npx -y shizai-agent-mcp uninstall
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
当前 npm launcher 版本为 `0.2.
|
|
27
|
+
当前 npm launcher 版本为 `0.2.8`,默认下载最新的 `v0.6.7` Windows x64 资产:
|
|
28
28
|
`shizai-agent-v0.6.7-windows-x64.zip`。npm 包不附带浏览器自动化依赖,也不要求用户安装额外扩展。
|
|
29
|
+
|
|
30
|
+
`install` 覆盖文件后会自动注册 Codex MCP;需要跳过配置写入时使用
|
|
31
|
+
`install --skip-register`,之后可单独运行 `register codex`。
|
|
29
32
|
|
|
30
33
|
发布 Release 时必须同时上传同名 `.sha256` 文件。安装器先校验、解压到同盘暂存目录,
|
|
31
34
|
再原子替换现有版本;失败会恢复旧安装。测试企业内网镜像时可设置
|
package/bin/shizai-agent-mcp.js
CHANGED
|
@@ -116,7 +116,7 @@ function download(url, destination) {
|
|
|
116
116
|
const script = `Invoke-WebRequest -UseBasicParsing -Uri ${psQuote(url)} -OutFile ${psQuote(destination)}`;
|
|
117
117
|
runPowerShell(script);
|
|
118
118
|
}
|
|
119
|
-
function install(version) {
|
|
119
|
+
function install(version, options = {}) {
|
|
120
120
|
const destination = validateInstallRoot();
|
|
121
121
|
const asset = assetName(version);
|
|
122
122
|
const url = releaseUrl(version, asset);
|
|
@@ -189,7 +189,10 @@ function install(version) {
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
cleanupInstallArtifacts(parent, [stage, backup]);
|
|
192
|
-
|
|
192
|
+
const result = { installed: true, version, directory: destination, command: binaryPath(), verified, stopped_processes: [...stoppedProcesses].sort((left, right) => left - right) };
|
|
193
|
+
if (!options.skipRegister) result.registration = registerCodex(true);
|
|
194
|
+
json(result);
|
|
195
|
+
return result;
|
|
193
196
|
} finally {
|
|
194
197
|
removeDirectoryWithRetries(temp);
|
|
195
198
|
removeDirectoryWithRetries(stage);
|
|
@@ -203,7 +206,7 @@ function replaceTomlSection(content, section, replacement) {
|
|
|
203
206
|
return `${next}${next ? '\r\n\r\n' : ''}${replacement.trim()}\r\n`;
|
|
204
207
|
}
|
|
205
208
|
function tomlString(value) { return JSON.stringify(String(value)); }
|
|
206
|
-
function registerCodex() {
|
|
209
|
+
function registerCodex(silent = false) {
|
|
207
210
|
const config = process.env.SHIZAI_CODEX_CONFIG || path.join(os.homedir(), '.codex', 'config.toml');
|
|
208
211
|
fs.mkdirSync(path.dirname(config), { recursive: true });
|
|
209
212
|
const old = fs.existsSync(config) ? fs.readFileSync(config, 'utf8') : '';
|
|
@@ -211,7 +214,9 @@ function registerCodex() {
|
|
|
211
214
|
const section = `[mcp_servers.${SERVER}]\ncommand = ${tomlString(binaryPath())}\nargs = []\nstartup_timeout_sec = 30\ntool_timeout_sec = 120`;
|
|
212
215
|
const next = replaceTomlSection(old, `mcp_servers.${SERVER}`, section);
|
|
213
216
|
fs.writeFileSync(config, next, 'utf8');
|
|
214
|
-
|
|
217
|
+
const result = { registered: true, client: 'codex', config, command: binaryPath() };
|
|
218
|
+
if (!silent) json(result);
|
|
219
|
+
return result;
|
|
215
220
|
}
|
|
216
221
|
function registerJsonClient(client) {
|
|
217
222
|
const locations = {
|
|
@@ -241,7 +246,7 @@ function main() {
|
|
|
241
246
|
const index = args.indexOf('--version');
|
|
242
247
|
const version = index >= 0 ? args[index + 1] : args.find(value => !value.startsWith('-'));
|
|
243
248
|
if (index >= 0 && !version) throw new Error('--version 后需要版本号');
|
|
244
|
-
return install(version || DEFAULT_VERSION);
|
|
249
|
+
return install(version || DEFAULT_VERSION, { skipRegister: args.includes('--skip-register') });
|
|
245
250
|
}
|
|
246
251
|
if (command === 'register') {
|
|
247
252
|
if (!fs.existsSync(binaryPath())) throw new Error('尚未安装,请先运行 install');
|