@agentguardx/helper 0.3.90 → 0.3.92
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 +7 -3
- package/lib/wizard.cjs +17 -9
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ agentguard init --server https://企业服务器域名
|
|
|
10
10
|
|
|
11
11
|
公共 npmjs 尚未发布;可发布到企业私有仓库后用 `npx --registry <仓库地址> @agentguardx/helper`(见 docs/client/B13_INSTALLATION.md 的发布步骤),或使用管理员分发的离线 tgz。离线安装时同时安装主包和本机对应的平台包;全局命令仍为 `agentguard`。包不固定企业服务器地址;可交互填写,或使用 `--server` / `AGENTGUARD_SERVER`。支持 HTTP/HTTPS;HTTP 每个新服务器先明确确认明文风险,确认前不发送令牌。
|
|
12
12
|
|
|
13
|
-
npx 即用不会创建全局 `agentguard` 命令;后续使用 `npx @agentguardx/helper launch opencode
|
|
13
|
+
npx 即用不会创建全局 `agentguard` 命令;后续使用 `npx @agentguardx/helper launch opencode`(OpenCode 已原生接入时也可直接运行 `opencode`)、`npx @agentguardx/helper uninstall`,或全局安装后使用短命令。
|
|
14
14
|
|
|
15
15
|
向导先显示当前服务器地址(优先级:`--server` 参数 > 环境变量 `AGENTGUARD_SERVER` > 上次保存的配置)作为默认值:回车沿用,也可直接输入别的 IP 或域名;输入后重新校验 `/client/v1/config`,HTTP 只提示一次明文风险。已有登录属于旧服务器时,向导提示需要重新登录,并在你确认后先退出旧登录(撤销旧令牌、恢复已接入工具配置);旧令牌绝不会发给新服务器。命令行同样可用:`agentguard server show` 查看当前地址,`agentguard server set <地址>` 修改(加 `--switch` 同时退出旧登录并恢复工具配置;旧服务器无法访问时可再加 `--local-only`,只清除本机登录,旧令牌在服务端仍有效直到到期或由管理员撤销)。
|
|
16
16
|
|
|
@@ -31,12 +31,16 @@ Claude Desktop 的 stdio 桥接保存当前 Node 程序与主包启动器的绝
|
|
|
31
31
|
本机安全工具命令(全局安装示例;仅 npx 使用时替换为 `npx -- @agentguardx/helper`):
|
|
32
32
|
|
|
33
33
|
```sh
|
|
34
|
-
agentguard connect opencode
|
|
35
|
-
agentguard launch
|
|
34
|
+
agentguard connect opencode # 原生模式(默认):把 OpenCode 默认模型设为 AgentGuard,之后直接运行 opencode 即可
|
|
35
|
+
agentguard connect opencode --launch-only # 旧方式:不改默认模型、不落地令牌,只能经 launch 启动
|
|
36
|
+
agentguard launch opencode # 仍可用,令牌只交给本次子进程
|
|
37
|
+
agentguard disconnect opencode # 恢复原默认模型,删除写入的令牌
|
|
36
38
|
agentguard mcp serve
|
|
37
39
|
agentguard pause
|
|
38
40
|
agentguard resume
|
|
39
41
|
agentguard activity
|
|
40
42
|
```
|
|
41
43
|
|
|
44
|
+
OpenCode 原生模式的令牌与 GLM 编程助手同类,写入 OpenCode 自己的 `auth.json`(键 `agentguard`,0600,保留其他条目)和 AgentGuard 配置目录下 0600 的令牌文件(供远程 MCP 请求头的 `{file:}` 引用);`opencode.json` 不含令牌。`disconnect`、`uninstall`、`logout` 会清除这些副本并恢复原 `model`/`small_model`。
|
|
45
|
+
|
|
42
46
|
`mcp serve` 的 stdout 专用于 stdio MCP 协议,工作根固定为进程启动目录,不接受模型自报身份或 root。`pause` 是本机应急停用,不是企业级一键暂停,也不能撤回已发生的副作用。
|
package/lib/wizard.cjs
CHANGED
|
@@ -91,19 +91,22 @@ function config(server) {
|
|
|
91
91
|
request.on('timeout', () => request.destroy()); request.on('error', () => reject(new Error('server_config_unavailable')));
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function supportedTools() {
|
|
95
95
|
const home = os.homedir(), windows = process.platform === 'win32';
|
|
96
96
|
const command = name => (process.env.PATH || '').split(path.delimiter).some(dir => (windows ? ['', '.exe', '.cmd', '.bat'] : ['']).some(ext => {
|
|
97
97
|
try { const file = path.join(dir, name + ext); return fs.statSync(file).isFile() && (windows || (fs.accessSync(file, fs.constants.X_OK), true)); } catch { return false; }
|
|
98
98
|
}));
|
|
99
99
|
const apps = (mac, win) => process.platform === 'darwin' ? ['/Applications', path.join(home, 'Applications')].some(dir => fs.existsSync(path.join(dir, mac))) : windows && !!process.env.LOCALAPPDATA && fs.existsSync(path.join(process.env.LOCALAPPDATA, win));
|
|
100
100
|
return [
|
|
101
|
-
{ label: 'OpenCode(模型与远程 MCP)', value: 'opencode', present: command('opencode') },
|
|
102
|
-
{ label: 'OpenClaw(模型)', value: 'openclaw', present: command('openclaw') },
|
|
103
|
-
{ label: 'Cursor(远程 MCP)', value: 'cursor', present: command('cursor') || apps('Cursor.app', 'Programs/Cursor/Cursor.exe') },
|
|
104
|
-
{ label: 'Claude Desktop(MCP 桥接)', value: 'claude-desktop', present: command('claude-desktop') || apps('Claude.app', 'AnthropicClaude/Claude.exe') },
|
|
105
|
-
{ label: 'Cherry Studio(手动填写说明)', value: 'cherry-studio', present: apps('Cherry Studio.app', 'Programs/Cherry Studio/Cherry Studio.exe') },
|
|
106
|
-
]
|
|
101
|
+
{ label: 'OpenCode(模型与远程 MCP)', value: 'opencode', present: command('opencode'), install: 'npm i -g opencode-ai' },
|
|
102
|
+
{ label: 'OpenClaw(模型)', value: 'openclaw', present: command('openclaw'), install: '按 OpenClaw 官方说明安装' },
|
|
103
|
+
{ label: 'Cursor(远程 MCP)', value: 'cursor', present: command('cursor') || apps('Cursor.app', 'Programs/Cursor/Cursor.exe'), install: '从 cursor.com 下载安装' },
|
|
104
|
+
{ label: 'Claude Desktop(MCP 桥接)', value: 'claude-desktop', present: command('claude-desktop') || apps('Claude.app', 'AnthropicClaude/Claude.exe'), install: '从 claude.ai/download 下载安装' },
|
|
105
|
+
{ label: 'Cherry Studio(手动填写说明)', value: 'cherry-studio', present: apps('Cherry Studio.app', 'Programs/Cherry Studio/Cherry Studio.exe'), install: '从 cherry-ai.com 下载安装' },
|
|
106
|
+
];
|
|
107
|
+
}
|
|
108
|
+
function detectedTools() {
|
|
109
|
+
return supportedTools().filter(item => item.present);
|
|
107
110
|
}
|
|
108
111
|
async function currentServer(runtime, prefix, flagServer) {
|
|
109
112
|
// Priority --server > AGENTGUARD_SERVER > saved configuration is resolved by the Go core.
|
|
@@ -194,11 +197,16 @@ async function init(runtime, args) {
|
|
|
194
197
|
} else code = await run(runtime, [...prefix, 'login', '--server', server, ...httpFlags, '--defer-notice'], '');
|
|
195
198
|
if (code) { process.exitCode = code; return; }
|
|
196
199
|
const tools = detectedTools();
|
|
197
|
-
|
|
200
|
+
const missing = supportedTools().filter(item => !item.present);
|
|
201
|
+
if (missing.length) {
|
|
202
|
+
process.stdout.write('以下支持的工具在本机未检测到,安装后运行 npx @agentguardx/helper connect <工具名> 接入:\n');
|
|
203
|
+
for (const item of missing) process.stdout.write(` - ${item.label}:${item.install}(工具名 ${item.value})\n`);
|
|
204
|
+
}
|
|
205
|
+
if (!tools.length) process.stdout.write('本机暂未检测到支持的工具。\n');
|
|
198
206
|
else {
|
|
199
207
|
const selected = await choose(ask, '选择要接入的已检测工具', tools, true);
|
|
200
208
|
for (const tool of selected) { code = await run(runtime, [...prefix, 'connect', tool], ''); if (code) { process.exitCode = code; return; } }
|
|
201
|
-
if (selected.includes('opencode')) process.stdout.write('OpenCode
|
|
209
|
+
if (selected.includes('opencode')) process.stdout.write('OpenCode 已设为默认走 AgentGuard(原默认模型已记录,断开时恢复):直接运行 opencode 即可,也可用 launch 启动。接入包含本机安全 MCP 配置,使用 ag_* 工具;实际连接与授权结果以诊断和服务端记录为准。\n');
|
|
202
210
|
}
|
|
203
211
|
process.stdout.write('运行实际诊断:\n'); code = await run(runtime, [...prefix, 'doctor'], ''); process.exitCode = code;
|
|
204
212
|
process.stdout.write(code === 0 ? '初始化完成。用 npx @agentguardx/helper launch <工具名> 启动;全局安装后也可用 agentguard launch <工具名>。\n' : '诊断未全部通过,请按上述实际结果处理。\n');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentguardx/helper",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.92",
|
|
4
4
|
"description": "AgentGuard \u5458\u5de5\u63a5\u5165\u52a9\u624b",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"engines": {
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"preuninstall": "node lib/preuninstall.cjs"
|
|
20
20
|
},
|
|
21
21
|
"optionalDependencies": {
|
|
22
|
-
"@agentguardx/helper-darwin-x64": "0.3.
|
|
23
|
-
"@agentguardx/helper-darwin-arm64": "0.3.
|
|
24
|
-
"@agentguardx/helper-linux-x64": "0.3.
|
|
25
|
-
"@agentguardx/helper-linux-arm64": "0.3.
|
|
26
|
-
"@agentguardx/helper-win32-x64": "0.3.
|
|
27
|
-
"@agentguardx/helper-win32-arm64": "0.3.
|
|
22
|
+
"@agentguardx/helper-darwin-x64": "0.3.92",
|
|
23
|
+
"@agentguardx/helper-darwin-arm64": "0.3.92",
|
|
24
|
+
"@agentguardx/helper-linux-x64": "0.3.92",
|
|
25
|
+
"@agentguardx/helper-linux-arm64": "0.3.92",
|
|
26
|
+
"@agentguardx/helper-win32-x64": "0.3.92",
|
|
27
|
+
"@agentguardx/helper-win32-arm64": "0.3.92"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|