nexus-agentd 0.2.1 → 0.2.2
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 +6 -2
- package/dist/acp/runtime.js +13 -1
- package/dist/config.js +3 -1
- package/dist/control-plane.js +2 -1
- package/dist/types.d.ts +1 -1
- package/dist/webui/app.js +5 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -97,8 +97,12 @@ npm install -g \
|
|
|
97
97
|
pi-acp
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
`command`、`args`、`inheritEnv` 和 `env` 是仅可在本机配置文件修改的高级字段,WebUI 不接受这些
|
|
101
|
-
字段。Workspace 在启动进程前经过 `realpath` 边界校验。
|
|
100
|
+
`command`、`args`、`inheritEnv` 和 `env` 是仅可在本机配置文件修改的高级字段,WebUI 不接受这些
|
|
101
|
+
字段。Workspace 在启动进程前经过 `realpath` 边界校验。
|
|
102
|
+
|
|
103
|
+
ACP 权限策略支持 `ask`(询问)、`allow`(始终允许)和 `deny`(拒绝)。`allow` 会优先选择
|
|
104
|
+
Agent 提供的 `allow_once`,不创建待确认请求;它适合管理员明确授权、工作区边界可信的自动化 Agent。
|
|
105
|
+
默认仍为 `ask`。
|
|
102
106
|
|
|
103
107
|
### A2A
|
|
104
108
|
|
package/dist/acp/runtime.js
CHANGED
|
@@ -62,7 +62,7 @@ export class AcpProcessRuntime {
|
|
|
62
62
|
},
|
|
63
63
|
clientInfo: {
|
|
64
64
|
name: 'nexus-agentd',
|
|
65
|
-
version: '0.2.
|
|
65
|
+
version: '0.2.2'
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
if (initialize.protocolVersion !== acp.PROTOCOL_VERSION) {
|
|
@@ -249,6 +249,18 @@ export class AcpProcessRuntime {
|
|
|
249
249
|
}
|
|
250
250
|
: { outcome: { outcome: 'cancelled' } };
|
|
251
251
|
}
|
|
252
|
+
if (this.driver.permissionPolicy === 'allow') {
|
|
253
|
+
const allow = params.options.find((option) => option.kind.toLowerCase() === 'allow_once') ||
|
|
254
|
+
params.options.find((option) => option.kind.toLowerCase().startsWith('allow'));
|
|
255
|
+
return allow
|
|
256
|
+
? {
|
|
257
|
+
outcome: {
|
|
258
|
+
outcome: 'selected',
|
|
259
|
+
optionId: allow.optionId
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
: { outcome: { outcome: 'cancelled' } };
|
|
263
|
+
}
|
|
252
264
|
if (this.pending) {
|
|
253
265
|
return { outcome: { outcome: 'cancelled' } };
|
|
254
266
|
}
|
package/dist/config.js
CHANGED
|
@@ -134,7 +134,9 @@ function parseAgent(id, value) {
|
|
|
134
134
|
throw new Error(`Unsupported nexus-agentd driver: ${driver || id}`);
|
|
135
135
|
}
|
|
136
136
|
const permissionPolicy = optionalString(input.permissionPolicy, `agents.${id}.permissionPolicy`) || 'ask';
|
|
137
|
-
if (permissionPolicy !== 'ask' &&
|
|
137
|
+
if (permissionPolicy !== 'ask' &&
|
|
138
|
+
permissionPolicy !== 'allow' &&
|
|
139
|
+
permissionPolicy !== 'deny') {
|
|
138
140
|
throw new Error(`Invalid permissionPolicy for ${id}`);
|
|
139
141
|
}
|
|
140
142
|
const result = {
|
package/dist/control-plane.js
CHANGED
|
@@ -501,8 +501,9 @@ function validateUpdate(update) {
|
|
|
501
501
|
}
|
|
502
502
|
if (update.permissionPolicy !== undefined &&
|
|
503
503
|
update.permissionPolicy !== 'ask' &&
|
|
504
|
+
update.permissionPolicy !== 'allow' &&
|
|
504
505
|
update.permissionPolicy !== 'deny') {
|
|
505
|
-
throw new ControlPlaneError(400, 'permissionPolicy must be ask or deny');
|
|
506
|
+
throw new ControlPlaneError(400, 'permissionPolicy must be ask, allow, or deny');
|
|
506
507
|
}
|
|
507
508
|
if (update.preferredTransport !== undefined &&
|
|
508
509
|
!['auto', 'jsonrpc', 'http-json'].includes(update.preferredTransport)) {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type AgentdSessionState = 'created' | 'running' | 'input_required' | 'permission_required' | 'completed' | 'failed' | 'canceled';
|
|
2
2
|
export type AgentdProtocol = 'acp' | 'a2a';
|
|
3
|
-
export type PermissionPolicy = 'ask' | 'deny';
|
|
3
|
+
export type PermissionPolicy = 'ask' | 'allow' | 'deny';
|
|
4
4
|
export type AgentdTurnCompletionSource = 'acp_prompt_response' | 'a2a_task_status' | 'a2a_message_stream';
|
|
5
5
|
export interface AgentdTurnCompletionProof {
|
|
6
6
|
source: AgentdTurnCompletionSource;
|
package/dist/webui/app.js
CHANGED
|
@@ -441,9 +441,10 @@ export const app = String.raw `
|
|
|
441
441
|
'</div></td><td><span class="badge">' + escapeHtml(agent.protocol.toUpperCase()) + '</span></td><td>' + escapeHtml(agent.driver || '—') + '</td><td>' + statusMarkup(statusAgent) + '</td><td>' + escapeHtml(agent.workspace || '—') + '</td><td>' + escapeHtml(permissionLabel(agent.permissionPolicy)) + '</td><td><div class="row-actions"><button class="button small" data-agent-edit="' + escapeHtml(agent.id) + '">编辑</button><button class="button small danger" data-agent-delete="' + escapeHtml(agent.id) + '">删除</button></div></td></tr>'
|
|
442
442
|
}
|
|
443
443
|
|
|
444
|
-
function permissionLabel(value) {
|
|
445
|
-
if (value === 'ask') return '询问'
|
|
446
|
-
if (value === '
|
|
444
|
+
function permissionLabel(value) {
|
|
445
|
+
if (value === 'ask') return '询问'
|
|
446
|
+
if (value === 'allow') return '始终允许'
|
|
447
|
+
if (value === 'deny') return '拒绝'
|
|
447
448
|
return value || '—'
|
|
448
449
|
}
|
|
449
450
|
|
|
@@ -545,7 +546,7 @@ export const app = String.raw `
|
|
|
545
546
|
'<div class="field-row"><label>协议<select name="protocol"><option value="acp"' + selected(current.protocol, 'acp') + '>ACP</option><option value="a2a"' + selected(current.protocol, 'a2a') + '>A2A</option></select></label><label class="checkbox"><input name="enabled" type="checkbox"' + checked(current.enabled) + '>启用</label></div>' +
|
|
546
547
|
'<label>名称<input name="name" value="' + escapeHtml(current.name || '') + '" required></label>' +
|
|
547
548
|
'<label>描述<textarea name="description">' + escapeHtml(current.description || '') + '</textarea></label>' +
|
|
548
|
-
'<div data-protocol-section="acp"><label>驱动<select name="driver">' + drivers + '</select></label><label>工作区<input name="workspace" list="workspace-roots" value="' + escapeHtml(current.workspace || state.config.workspaceRoots[0] || '') + '" required><datalist id="workspace-roots">' + roots + '</datalist></label><div class="field-row"><label>权限策略<select name="permissionPolicy"><option value="ask"' + selected(current.permissionPolicy, 'ask') + '>询问</option><option value="deny"' + selected(current.permissionPolicy, 'deny') + '>拒绝</option></select></label><label>权限确认超时(秒)<input name="permissionTimeoutMs" type="number" min="1" max="86400" step="1" value="' + escapeHtml(permissionTimeoutSeconds) + '"><small class="field-help">单位:秒;默认 900 秒,最长 24
|
|
549
|
+
'<div data-protocol-section="acp"><label>驱动<select name="driver">' + drivers + '</select></label><label>工作区<input name="workspace" list="workspace-roots" value="' + escapeHtml(current.workspace || state.config.workspaceRoots[0] || '') + '" required><datalist id="workspace-roots">' + roots + '</datalist></label><div class="field-row"><label>权限策略<select name="permissionPolicy"><option value="ask"' + selected(current.permissionPolicy, 'ask') + '>询问</option><option value="allow"' + selected(current.permissionPolicy, 'allow') + '>始终允许</option><option value="deny"' + selected(current.permissionPolicy, 'deny') + '>拒绝</option></select></label><label>权限确认超时(秒)<input name="permissionTimeoutMs" type="number" min="1" max="86400" step="1" value="' + escapeHtml(permissionTimeoutSeconds) + '"><small class="field-help">单位:秒;默认 900 秒,最长 24 小时;“始终允许”不会等待确认。</small></label></div></div>' +
|
|
549
550
|
'<div data-protocol-section="a2a"><label>Agent Card URL<input name="agentCardUrl" type="url" value="' + escapeHtml(current.agentCardUrl || '') + '" placeholder="http://agent.local:8080/.well-known/agent-card.json" required><small class="field-help">填写完整的 Agent Card JSON 地址;调用地址和能力将从 Card 自动发现。</small></label><div class="field-row"><label>首选传输<select name="preferredTransport"><option value="auto"' + selected(current.preferredTransport || 'auto', 'auto') + '>自动(按 Card)</option><option value="jsonrpc"' + selected(current.preferredTransport, 'jsonrpc') + '>JSON-RPC</option><option value="http-json"' + selected(current.preferredTransport, 'http-json') + '>HTTP+JSON</option></select></label><label>认证方式<select name="authType"><option value="none"' + selected(current.auth && current.auth.type || 'none', 'none') + '>无认证</option><option value="bearer"' + selected(current.auth && current.auth.type, 'bearer') + '>Bearer Token</option><option value="header"' + selected(current.auth && current.auth.type, 'header') + '>自定义请求头</option></select></label></div><label data-auth-header>请求头名称<input name="authHeaderName" value="' + escapeHtml(current.auth && current.auth.headerName || '') + '" placeholder="X-API-Key"></label><label data-auth-value><span data-auth-value-label>认证凭据</span><input name="authValue" type="password" autocomplete="off" placeholder="' + (editing && current.auth && current.auth.configured ? '留空以保留当前凭据' : '') + '"></label><label>请求超时(秒)<input name="timeoutMs" type="number" min="1" max="1800" step="1" value="' + escapeHtml(requestTimeoutSeconds) + '"><small class="field-help">单位:秒;默认 60 秒;用于限制这个 A2A Agent 的单次请求,最大 1800 秒(30 分钟)。</small></label></div>'
|
|
550
551
|
openDrawer(editing ? '编辑智能体' : '添加智能体', body, editing ? '保存修改' : '添加智能体', async (form) => {
|
|
551
552
|
const data = new FormData(form)
|