evolcore 0.0.11 → 0.0.13
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/CHANGELOG.md +44 -0
- package/bin/codex-managed-hook.mjs +80 -0
- package/bin/ec-safe-output.js +26 -7
- package/dist/agents/claude-runner.js +86 -7
- package/dist/agents/codex-app-server-client.js +174 -20
- package/dist/agents/codex-runner.js +375 -92
- package/dist/agents/ecagent-runner.js +39 -4
- package/dist/agents/gemini-runner.js +1 -0
- package/dist/aun/aid/client.js +11 -21
- package/dist/aun/aid/control-aid.js +36 -13
- package/dist/aun/aid/managed-operation.js +107 -0
- package/dist/aun/aid/store.js +13 -7
- package/dist/aun/group-fs-download.js +56 -0
- package/dist/aun/group-identity.js +1 -2
- package/dist/aun/msg/group.js +91 -44
- package/dist/aun/msg/index.js +1 -2
- package/dist/aun/msg/managed-operation.js +865 -0
- package/dist/aun/msg/mention-schema.js +20 -0
- package/dist/aun/msg/p2p.js +7 -0
- package/dist/aun/msg/upload.js +16 -1
- package/dist/aun/outbox.js +31 -2
- package/dist/aun/rpc/client.js +66 -0
- package/dist/aun/rpc/index.js +1 -2
- package/dist/aun/storage/{upload.js → client.js} +11 -2
- package/dist/aun/storage/index.js +1 -2
- package/dist/channels/aun.js +655 -240
- package/dist/channels/daemon.js +13 -0
- package/dist/cli/agent-command.js +56 -8
- package/dist/cli/agent.js +108 -31
- package/dist/cli/aun-commands.js +270 -69
- package/dist/cli/bench.js +12 -3
- package/dist/cli/cli-argv.js +10 -0
- package/dist/cli/config.js +9 -17
- package/dist/cli/ctl-command.js +1 -1
- package/dist/cli/daemon-commands.js +70 -55
- package/dist/cli/fs-command.js +79 -10
- package/dist/cli/handoff-command.js +3 -0
- package/dist/cli/index.js +30 -2
- package/dist/cli/init.js +77 -8
- package/dist/cli/managed-command-guard.js +41 -0
- package/dist/cli/model.js +11 -4
- package/dist/cli/queue-command.js +53 -1
- package/dist/cli/response.js +71 -0
- package/dist/cli/restart-monitor.js +7 -32
- package/dist/cli/trigger-command.js +11 -0
- package/dist/config/access-policy.js +1 -2
- package/dist/config/builtin-roles.js +9 -0
- package/dist/config/config-manager.js +21 -1
- package/dist/config/contact-book-store.js +11 -3
- package/dist/config/contact-request-service.js +161 -15
- package/dist/config/mention-mode.js +8 -24
- package/dist/config/peer-role-resolver.js +6 -2
- package/dist/config/role-migration-startup.js +53 -0
- package/dist/config/role-store.js +1 -1
- package/dist/core/auth/agent-delegation.js +1 -2
- package/dist/core/auth/auth-gateway.js +29 -1
- package/dist/core/auth/authorization-audit.js +15 -0
- package/dist/core/auth/operation-authorizer.js +31 -7
- package/dist/core/auth/operation-catalog.js +196 -25
- package/dist/core/bootstrap-messages.js +25 -0
- package/dist/core/bootstrap-service.js +64 -4
- package/dist/core/capability/providers/claude-capability-provider.js +9 -31
- package/dist/core/capability/providers/codex-capability-provider.js +4 -15
- package/dist/core/capability/skill-discovery.js +55 -0
- package/dist/core/channel-loader.js +1 -1
- package/dist/core/command/cli-intent-parser.js +9 -0
- package/dist/core/command/command-handler.js +650 -42
- package/dist/core/command/connect-menu.js +15 -0
- package/dist/core/command/group-menu.js +4 -4
- package/dist/core/command/menu-catalog.js +370 -0
- package/dist/core/command/menu-handler.js +230 -51
- package/dist/core/command/menu-protocol.js +94 -2
- package/dist/core/command/slash-gate.js +5 -2
- package/dist/core/command/slash-handler.js +99 -31
- package/dist/core/daemon-file-cache.js +2 -1
- package/dist/core/data-migration.js +9 -2
- package/dist/core/event-catalog.js +6 -0
- package/dist/core/evolagent.js +4 -2
- package/dist/core/handoff/dispatcher.js +5 -2
- package/dist/core/handoff/runtime.js +157 -22
- package/dist/core/handoff/store.js +29 -1
- package/dist/core/handoff/types.js +1 -0
- package/dist/core/interaction-router.js +10 -0
- package/dist/core/message/im-renderer.js +19 -0
- package/dist/core/message/logical-queue-bridge.js +1 -0
- package/dist/core/message/mention-schema.js +126 -0
- package/dist/core/message/message-bridge.js +298 -88
- package/dist/core/message/message-log.js +3 -0
- package/dist/core/message/message-queue.js +268 -39
- package/dist/core/message/message-utils.js +81 -4
- package/dist/core/message/response-engine.js +161 -77
- package/dist/core/message/stream-debouncer.js +10 -2
- package/dist/core/permission/approval-gateway.js +1 -0
- package/dist/core/permission/ec-command-parser.js +243 -18
- package/dist/core/permission/index.js +1 -1
- package/dist/core/permission/mode.js +15 -0
- package/dist/core/permission/readonly-shell-query.js +148 -8
- package/dist/core/permission/sandbox-runtime.js +43 -1
- package/dist/core/permission/tool-policy.js +322 -57
- package/dist/core/protected-paths.js +114 -4
- package/dist/core/session/session-manager.js +42 -4
- package/dist/core/session/session-mapper.js +20 -1
- package/dist/eck/detect.js +18 -1
- package/dist/eck/group-rules-sync.js +15 -44
- package/dist/eck/manifest-engine.js +39 -13
- package/dist/index.js +541 -180
- package/dist/ipc.js +232 -10
- package/dist/paths.js +3 -0
- package/dist/response-system/coordinator.js +6 -4
- package/dist/response-system/engines/v1/proactive-flow.js +26 -8
- package/dist/response-system/modes/single-session/index.js +14 -1
- package/dist/response-system/selector.js +6 -5
- package/dist/trigger/anomaly-store.js +4 -0
- package/dist/trigger/feedback.js +64 -11
- package/dist/trigger/manager.js +21 -1
- package/dist/trigger/parser.js +14 -2
- package/dist/trigger/scheduler.js +1 -0
- package/dist/trigger/script-executor.js +1 -0
- package/dist/trigger/validation.js +67 -6
- package/dist/utils/codex-app-server-registry.js +90 -0
- package/dist/utils/codex-cli.js +5 -1
- package/dist/utils/cross-platform.js +15 -0
- package/dist/utils/ecweb-supervisor.js +332 -0
- package/dist/utils/error-utils.js +10 -0
- package/dist/utils/npm-ops.js +5 -12
- package/dist/utils/tool-summary.js +11 -0
- package/kits/docs/channels/aun.md +1 -1
- package/kits/docs/context-assembly.md +2 -2
- package/kits/docs/evolcore/agent.md +11 -6
- package/kits/docs/evolcore/aid.md +14 -0
- package/kits/docs/evolcore/trigger.md +17 -1
- package/kits/docs/prompt-loading-architecture.md +1 -2
- package/kits/docs/venues/group.md +1 -1
- package/kits/eck_manifest.json +0 -12
- package/kits/migrations/migrate-contact-book-v2.mjs +1 -2
- package/kits/rules/04-relation.md +1 -1
- package/kits/rules/05-venue.md +2 -2
- package/kits/schemas/role-config.schema.1.json +1 -0
- package/kits/schemas/single-session.schema.1.json +3 -3
- package/kits/schemas/single-session.schema.2.json +3 -3
- package/kits/templates/roles/admin.json +27 -0
- package/kits/templates/roles/member.json +34 -1
- package/kits/templates/roles/visitor.json +35 -3
- package/kits/templates/system-fragments/bootstrap.md +1 -1
- package/kits/templates/system-fragments/channel.md +1 -1
- package/kits/templates/system-fragments/session.md +1 -1
- package/package.json +2 -2
- package/dist/aun/msg/payload-type.js +0 -27
- package/dist/aun/rpc/caller.js +0 -42
- package/dist/aun/rpc/connection.js +0 -25
- package/dist/aun/storage/manage.js +0 -10
- package/dist/config/access-policy-domain.js +0 -18
- package/dist/config/config-batch-get.js +0 -11
- package/dist/config/owner-policy.js +0 -4
- package/dist/config/role-config-v4-startup.js +0 -32
- package/dist/config/role-config-v5-startup.js +0 -27
- package/dist/core/auth/trigger-authorization.js +0 -15
- package/dist/core/command/evol-menu-version-gate.js +0 -39
- package/dist/core/interaction-registration.js +0 -10
- package/dist/core/permission/execution-sandbox.js +0 -16
- package/dist/core/relation/peer-key.js +0 -1
- package/dist/core/session/session-key.js +0 -24
- package/dist/eck/baseagent-caps.js +0 -18
- package/dist/eck/rules-loader.js +0 -28
package/kits/rules/05-venue.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
| 变量 | 取值 | 说明 |
|
|
6
6
|
|------|------|------|
|
|
7
7
|
| `chatType` | `private` / `group` / null | null = 无渠道的本地 coding 会话 |
|
|
8
|
-
| `mentionMode` | `mention-only` / `disabled` | 群内响应策略;取 agent/relation
|
|
8
|
+
| `mentionMode` | `mention-only` / `disabled` | 群内响应策略;取 agent/relation 配置,缺省时使用群服务器下发的 `mention_mode` |
|
|
9
9
|
| `clientType` | `desktop` / `web` / `mobile` | 有值时额外加载客户端场景文档 |
|
|
10
10
|
| `permissionMode` | readonly/auto/request/bypass | 当前生效权限模式 |
|
|
11
11
|
| `venueUid` | 恒为 undefined | 声明了但源码固定不填,模板有 `{{?}}` 守卫所以永不渲染——**不要依赖它** |
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
## Venue 类型抽象
|
|
40
40
|
|
|
41
41
|
环境层关注的是**类型**,而非具体实例。类型只有 `private` 和 `group` 两种(即 `chatType` 的两个非空取值)——
|
|
42
|
-
没有 `broadcast` 这个 venue
|
|
42
|
+
没有 `broadcast` 这个 venue 类型;群响应策略统一由 `mentionMode` 表达。
|
|
43
43
|
|
|
44
44
|
"张三所在的 team-alpha 这个**具体群**"不属于环境层,它是关系层的对端实例,数据落 `relations/<peerKey>/`。
|
|
45
45
|
|
|
@@ -132,6 +132,7 @@
|
|
|
132
132
|
"properties": {
|
|
133
133
|
"allow": { "type": "boolean", "description": "是否允许该角色执行匹配的 operation。" },
|
|
134
134
|
"dangerous": { "type": "boolean", "default": false, "description": "是否将该授权规则标记为危险操作规则;危险操作还会应用额外安全约束。" },
|
|
135
|
+
"permissionMode": { "type": "string", "enum": ["readonly", "auto", "request", "bypass"], "description": "临时 operation 级权限模式;后续迁移到作用域模式规则。" },
|
|
135
136
|
"scopes": {
|
|
136
137
|
"type": "array",
|
|
137
138
|
"items": { "type": "string", "enum": ["relation", "role", "agent", "process", "filesystem", "control", "raw-cli"], "description": "该命令权限适用的一个配置或执行作用域。", "x-enumDescriptions": { "relation": "当前 Agent 与对端的关系配置域", "role": "独立角色注册表或角色策略配置域", "agent": "单个 Agent 的配置与生命周期域", "process": "EvolCore 进程级配置与运行域", "filesystem": "受控文件系统操作域", "control": "控制面命令和管理通道域", "raw-cli": "未经结构化 operation 封装的原始 CLI 执行域" } },
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"type": "boolean",
|
|
12
12
|
"enum": [true, false],
|
|
13
13
|
"default": true,
|
|
14
|
-
"description": "proactive
|
|
14
|
+
"description": "proactive 首个本地工具表态检查(仅 chatmode=proactive 生效):首个可被 PreToolUse 覆盖的本地工具必须是当前会话精确对应的 ec msg/group send,否则拦截;WebSearch、图像生成、浏览器和 Computer Use 等 hosted 工具不进入此硬拒绝边界。",
|
|
15
15
|
"x-enumDescriptions": {
|
|
16
|
-
"true": "
|
|
17
|
-
"false": "
|
|
16
|
+
"true": "启用:首个 hook 可覆盖的本地工具必须是精确会话 send",
|
|
17
|
+
"false": "禁用:不执行 proactive 首个本地工具 send 检查"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"tool_use_reminder": {
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"type": "boolean",
|
|
35
35
|
"enum": [true, false],
|
|
36
36
|
"default": true,
|
|
37
|
-
"description": "proactive
|
|
37
|
+
"description": "proactive 首个本地工具表态检查(仅 chatmode=proactive 生效):首个可被 PreToolUse 覆盖的本地工具必须是当前会话精确对应的 ec msg/group send,否则拦截;WebSearch、图像生成、浏览器和 Computer Use 等 hosted 工具不进入此硬拒绝边界。",
|
|
38
38
|
"x-enumDescriptions": {
|
|
39
|
-
"true": "
|
|
40
|
-
"false": "
|
|
39
|
+
"true": "启用:首个 hook 可覆盖的本地工具必须是精确会话 send",
|
|
40
|
+
"false": "禁用:不执行 proactive 首个本地工具 send 检查"
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"tool_use_reminder": {
|
|
@@ -27,11 +27,21 @@
|
|
|
27
27
|
"role.revoke": { "allow": true, "scopes": ["agent"] },
|
|
28
28
|
"role.policy.read": { "allow": true, "scopes": ["agent"] },
|
|
29
29
|
"role.relation.read": { "allow": true, "scopes": ["agent"] },
|
|
30
|
+
"agent.baseagent.update": {
|
|
31
|
+
"allow": true,
|
|
32
|
+
"scopes": ["agent"],
|
|
33
|
+
"constraints": { "requireAgentOwner": true, "targetCurrentAgentOnly": true }
|
|
34
|
+
},
|
|
30
35
|
"observable.current": {
|
|
31
36
|
"allow": true,
|
|
32
37
|
"scopes": ["agent"],
|
|
33
38
|
"constraints": { "requireAgentOwner": true }
|
|
34
39
|
},
|
|
40
|
+
"observable.update": {
|
|
41
|
+
"allow": true,
|
|
42
|
+
"scopes": ["agent"],
|
|
43
|
+
"constraints": { "requireAgentOwner": true, "targetCurrentAgentOnly": true }
|
|
44
|
+
},
|
|
35
45
|
"config.get": { "allow": true, "scopes": ["agent", "relation"] },
|
|
36
46
|
"config.set": { "allow": true, "scopes": ["agent", "relation"] },
|
|
37
47
|
"config.unset": { "allow": true, "scopes": ["agent", "relation"] },
|
|
@@ -41,6 +51,23 @@
|
|
|
41
51
|
"scopes": ["agent"],
|
|
42
52
|
"constraints": { "requireAgentAdmin": true }
|
|
43
53
|
},
|
|
54
|
+
"ec.aid.show": {
|
|
55
|
+
"allow": true,
|
|
56
|
+
"dangerous": true,
|
|
57
|
+
"scopes": ["agent"],
|
|
58
|
+
"constraints": { "targetCurrentAgentOnly": true, "requireAgentAdmin": true }
|
|
59
|
+
},
|
|
60
|
+
"ec.aid.agentmd.put": {
|
|
61
|
+
"allow": true,
|
|
62
|
+
"dangerous": true,
|
|
63
|
+
"scopes": ["agent"],
|
|
64
|
+
"constraints": { "targetCurrentAgentOnly": true, "requireAgentAdmin": true }
|
|
65
|
+
},
|
|
66
|
+
"ec.fs.mkdir": { "allow": true, "permissionMode": "auto", "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
67
|
+
"ec.fs.upload": { "allow": true, "permissionMode": "auto", "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
68
|
+
"ec.fs.copy": { "allow": true, "permissionMode": "auto", "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
69
|
+
"ec.fs.move": { "allow": true, "permissionMode": "auto", "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
70
|
+
"ec.fs.remove": { "allow": true, "permissionMode": "auto", "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
44
71
|
"*": { "allow": true },
|
|
45
72
|
"agent.reload": {
|
|
46
73
|
"allow": true,
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"storage.*": { "allow": false },
|
|
25
25
|
"aid.*": { "allow": false },
|
|
26
26
|
"gateway.*": { "allow": false },
|
|
27
|
-
"group.list": { "allow":
|
|
27
|
+
"group.list": { "allow": true, "scopes": ["agent"], "constraints": { "targetCurrentAgentOnly": true } },
|
|
28
28
|
"agent.baseagent.current": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "targetCurrentAgentOnly": true } },
|
|
29
29
|
"agent.baseagent.list": { "allow": true, "scopes": ["agent"], "constraints": { "targetCurrentAgentOnly": true } },
|
|
30
30
|
"agent.*": { "allow": false },
|
|
@@ -53,8 +53,41 @@
|
|
|
53
53
|
"trigger.*": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "targetCurrentAgentOnly": true } },
|
|
54
54
|
"ec.msg.send": { "allow": true, "constraints": { "ownPeerOnly": true } },
|
|
55
55
|
"ec.msg.file": { "allow": true, "constraints": { "ownPeerOnly": true } },
|
|
56
|
+
"ec.msg.history": { "allow": true, "scopes": ["relation"], "constraints": { "privateOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
57
|
+
"ec.msg.online": { "allow": true, "scopes": ["relation"], "constraints": { "privateOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
58
|
+
"ec.version": { "allow": true },
|
|
59
|
+
"ec.aid.show": { "allow": true, "dangerous": true, "scopes": ["relation"], "constraints": { "targetCurrentAgentOnly": true } },
|
|
60
|
+
"ec.aid.lookup": { "allow": true, "scopes": ["relation"], "constraints": { "targetCurrentAgentOnly": true } },
|
|
61
|
+
"ec.aid.agentmd.get": { "allow": true, "scopes": ["relation"], "constraints": { "targetCurrentAgentOnly": true } },
|
|
62
|
+
"ec.aid.agentmd.put": { "allow": false },
|
|
63
|
+
"ec.fs.ls": { "allow": true, "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
64
|
+
"ec.fs.stat": { "allow": true, "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
65
|
+
"ec.fs.lstat": { "allow": true, "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
66
|
+
"ec.fs.cat": { "allow": true, "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
67
|
+
"ec.fs.find": { "allow": true, "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
68
|
+
"ec.fs.df": { "allow": true, "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
69
|
+
"ec.fs.mkdir": { "allow": true, "permissionMode": "auto", "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
70
|
+
"ec.fs.upload": { "allow": true, "permissionMode": "auto", "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
71
|
+
"ec.fs.copy": { "allow": true, "permissionMode": "auto", "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
72
|
+
"ec.fs.move": { "allow": true, "permissionMode": "auto", "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
73
|
+
"ec.fs.remove": { "allow": true, "permissionMode": "auto", "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
74
|
+
"ec.handoff.status": { "allow": true, "scopes": ["relation"], "constraints": { "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
75
|
+
"ec.handoff.list": { "allow": true, "scopes": ["relation"], "constraints": { "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
76
|
+
"ec.handoff.trace": { "allow": true, "scopes": ["relation"], "constraints": { "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
77
|
+
"ec.handoff.return": { "allow": true, "scopes": ["relation"], "constraints": { "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
78
|
+
"ec.queue.*": { "allow": false },
|
|
56
79
|
"ec.group.send": { "allow": true, "constraints": { "groupOnly": true, "currentRelationOnly": true } },
|
|
57
80
|
"ec.group.file": { "allow": true, "constraints": { "groupOnly": true, "currentRelationOnly": true } },
|
|
81
|
+
"ec.group.list": { "allow": true, "scopes": ["agent"], "constraints": { "targetCurrentAgentOnly": true } },
|
|
82
|
+
"ec.group.info": { "allow": true, "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
83
|
+
"ec.group.pull": { "allow": true, "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
84
|
+
"ec.group.members": { "allow": true, "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
85
|
+
"ec.group.online": { "allow": true, "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
86
|
+
"ec.group.rules.get": { "allow": true, "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
87
|
+
"ec.group.rules.read": { "allow": true, "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
88
|
+
"ec.ctl.send": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
89
|
+
"ec.ctl.file": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
90
|
+
"ec.ctl.queue.*": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
58
91
|
"ec.ctl.*": { "allow": false },
|
|
59
92
|
"cli.exec.raw": { "allow": false, "dangerous": true },
|
|
60
93
|
"dangerous:*": { "allow": false, "dangerous": true }
|
|
@@ -20,7 +20,11 @@
|
|
|
20
20
|
"config.get": { "allow": true, "scopes": ["relation"], "constraints": { "currentRelationOnly": true, "targetCurrentAgentOnly": true, "configFieldPolicy": "behavior-read" } },
|
|
21
21
|
"model.list": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "targetCurrentAgentOnly": true } },
|
|
22
22
|
"model.current": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "targetCurrentAgentOnly": true } },
|
|
23
|
-
"model.
|
|
23
|
+
"model.info": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "targetCurrentAgentOnly": true } },
|
|
24
|
+
"model.use": { "allow": false },
|
|
25
|
+
"model.effort": { "allow": false },
|
|
26
|
+
"model.reset": { "allow": false },
|
|
27
|
+
"model.check": { "allow": false },
|
|
24
28
|
"permission.current": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "targetCurrentAgentOnly": true } },
|
|
25
29
|
"permission.answer": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "targetCurrentAgentOnly": true } },
|
|
26
30
|
"chatmode.current": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "targetCurrentAgentOnly": true } },
|
|
@@ -32,9 +36,19 @@
|
|
|
32
36
|
"group.mentionmode.update": { "allow": false },
|
|
33
37
|
"group.rulespolicy.current": { "allow": true, "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
34
38
|
"group.rulespolicy.update": { "allow": false },
|
|
35
|
-
"
|
|
39
|
+
"group.list": { "allow": true, "scopes": ["agent"], "constraints": { "targetCurrentAgentOnly": true } },
|
|
40
|
+
"trigger.list": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "targetCurrentAgentOnly": true } },
|
|
41
|
+
"trigger.show": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "targetCurrentAgentOnly": true } },
|
|
42
|
+
"trigger.history": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "targetCurrentAgentOnly": true } },
|
|
43
|
+
"trigger.eventCatalog": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "targetCurrentAgentOnly": true } },
|
|
44
|
+
"trigger.create": { "allow": false },
|
|
45
|
+
"trigger.update": { "allow": false },
|
|
46
|
+
"trigger.setEnabled": { "allow": false },
|
|
47
|
+
"trigger.cancel": { "allow": false },
|
|
48
|
+
"trigger.delete": { "allow": false },
|
|
49
|
+
"trigger.run": { "allow": false },
|
|
36
50
|
"session.list": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true } },
|
|
37
|
-
"session.current": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true } },
|
|
51
|
+
"session.current": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "targetCurrentAgentOnly": true } },
|
|
38
52
|
"session.topic.current": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true } },
|
|
39
53
|
"session.topic.list": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true } },
|
|
40
54
|
"project.current": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "targetCurrentAgentOnly": true } },
|
|
@@ -43,8 +57,26 @@
|
|
|
43
57
|
"capability.read": { "allow": true, "scopes": ["agent"], "constraints": { "targetCurrentAgentOnly": true } },
|
|
44
58
|
"ec.msg.send": { "allow": true, "scopes": ["relation"], "constraints": { "ownPeerOnly": true, "privateOnly": true } },
|
|
45
59
|
"ec.msg.file": { "allow": false },
|
|
60
|
+
"ec.msg.history": { "allow": false },
|
|
61
|
+
"ec.msg.online": { "allow": false },
|
|
62
|
+
"ec.version": { "allow": true },
|
|
63
|
+
"ec.aid.show": { "allow": false },
|
|
64
|
+
"ec.aid.lookup": { "allow": true, "scopes": ["relation"], "constraints": { "targetCurrentAgentOnly": true } },
|
|
65
|
+
"ec.aid.agentmd.get": { "allow": false },
|
|
66
|
+
"ec.aid.agentmd.put": { "allow": false },
|
|
67
|
+
"ec.fs.*": { "allow": false },
|
|
68
|
+
"ec.handoff.*": { "allow": false },
|
|
69
|
+
"ec.queue.*": { "allow": false },
|
|
70
|
+
"storage.*": { "allow": false },
|
|
46
71
|
"ec.group.send": { "allow": true, "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true } },
|
|
47
72
|
"ec.group.file": { "allow": false },
|
|
73
|
+
"ec.group.list": { "allow": true, "scopes": ["agent"], "constraints": { "targetCurrentAgentOnly": true } },
|
|
74
|
+
"ec.group.info": { "allow": true, "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
75
|
+
"ec.group.pull": { "allow": false },
|
|
76
|
+
"ec.group.members": { "allow": false },
|
|
77
|
+
"ec.group.online": { "allow": false },
|
|
78
|
+
"ec.group.rules.get": { "allow": true, "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
79
|
+
"ec.group.rules.read": { "allow": true, "scopes": ["relation"], "constraints": { "groupOnly": true, "currentRelationOnly": true, "targetCurrentAgentOnly": true } },
|
|
48
80
|
"ec.ctl.*": { "allow": false },
|
|
49
81
|
"cli.exec.raw": { "allow": false, "dangerous": true },
|
|
50
82
|
"dangerous:*": { "allow": false, "dangerous": true }
|
|
@@ -17,6 +17,6 @@ phase: bootstrapping
|
|
|
17
17
|
5. owner 明确确认后,只编辑本地 agent.md(`$EVOLCORE_HOME/AIDs/{{selfAid}}/agent.md`)YAML frontmatter 中的 `name`、`description`、`tags`,保留其它字段和正文,并检查 YAML 与字段格式有效。
|
|
18
18
|
6. 调用 `ec aid agentmd put {{selfAid}}` 签名并发布 agent.md。只有命令明确成功后,才调用 `ec agent ready {{selfAid}}` 完成 bootstrap。
|
|
19
19
|
7. 任一步骤失败时,不调用 ready,不盲目重复尝试;说明具体失败原因并在修正后继续。
|
|
20
|
-
8. `ec agent ready {{selfAid}}` 必须是 bootstrap
|
|
20
|
+
8. `ec agent ready {{selfAid}}` 必须是 bootstrap 的最后一个操作。成功后系统会结束当前 bootstrap 上下文、创建全新的主会话并发送正式欢迎消息;不要再生成一段完成说明,也不要在旧上下文中继续处理任务。
|
|
21
21
|
|
|
22
22
|
完成前不要承诺已经进入正常工作状态,也不要尝试与上述流程无关的文件修改、网络通信或系统配置操作。
|
|
@@ -22,7 +22,7 @@ chatMode: {{chatMode}} # interactive=同步对话 / proactive=主动推送
|
|
|
22
22
|
# 设计意图:避免 agent↔agent 无限循环;某一方不再发送 → 对话自然终止。
|
|
23
23
|
# 拿不到 self-aid 时可用 ec ctl send "<text>"(自动继承当前 AID 和对端)。
|
|
24
24
|
# Shell 调用边界:每次工具调用只能执行一条完整的 ec 命令。
|
|
25
|
-
# 禁止拼接 command -v
|
|
25
|
+
# 禁止拼接 command -v。`ec aid` 仅允许对 {{selfAid}} 精确执行 show、lookup、agentmd get;仅 request/bypass 可执行 agentmd put。可选后缀仅限 --format json;禁止 &&、||、;、|、重定向、子 shell、bash -lc/sh -c 或其它脚本。
|
|
26
26
|
# 不要先做 CLI 探测;直接执行下方的单条 ec 命令,读取 JSON/回执后再决定下一步。
|
|
27
27
|
# 工具审批拒绝时原样报告并停止,不要通过追加其它命令或提权重试绕过审批。
|
|
28
28
|
{{/}}
|
|
@@ -44,7 +44,7 @@ readonly: true — 禁止写入项目目录及临时目录;如需生成文件
|
|
|
44
44
|
# - 每 {{proactiveToolReportInterval}} 次非发送工具调用后,必须先用发送命令汇报当前进展和下一步,否则后续非发送工具会被拒绝
|
|
45
45
|
{{/}}
|
|
46
46
|
# 命令速查:
|
|
47
|
-
# 每次工具调用只执行一条完整的 ec 命令;禁止 command -v
|
|
47
|
+
# 每次工具调用只执行一条完整的 ec 命令;禁止 command -v。`ec aid` 仅允许对 {{selfAid}} 精确执行 show、lookup、agentmd get;仅 request/bypass 可执行 agentmd put。可选后缀仅限 --format json;禁止 &&、||、;、|、重定向、子 shell、bash -lc/sh -c 或其它脚本与其串联。
|
|
48
48
|
# 审批拒绝时原样报告并停止;必须收到包含 message_id/status 的成功回执后才能声称已发送。
|
|
49
49
|
{{?chatType=group}}
|
|
50
50
|
# ec group send {{selfAid}} {{groupId}} "<text>" [--return none|required] [--file <path>] [--mention <aid>]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "evolcore",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "AI Agent gateway connecting Claude, Codex, Gemini, and the bundled ecagent runner to messaging channels with multi-project session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"prepublishOnly": "npm test"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@agentunion/fastaun": "
|
|
47
|
+
"@agentunion/fastaun": "0.5.6",
|
|
48
48
|
"@anthropic-ai/claude-agent-sdk": "0.3.220",
|
|
49
49
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
50
50
|
"ajv": "^8.20.0",
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
const EXT_TYPE_MAP = {
|
|
3
|
-
// image
|
|
4
|
-
'.png': 'image', '.jpg': 'image', '.jpeg': 'image',
|
|
5
|
-
'.gif': 'image', '.webp': 'image', '.svg': 'image',
|
|
6
|
-
'.bmp': 'image', '.heic': 'image', '.heif': 'image',
|
|
7
|
-
// video
|
|
8
|
-
'.mp4': 'video', '.mov': 'video', '.webm': 'video',
|
|
9
|
-
'.avi': 'video', '.mkv': 'video', '.m4v': 'video',
|
|
10
|
-
// voice
|
|
11
|
-
'.opus': 'voice', '.mp3': 'voice', '.aac': 'voice',
|
|
12
|
-
'.m4a': 'voice', '.wav': 'voice', '.flac': 'voice', '.ogg': 'voice',
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* 按扩展名推断 payload.type。
|
|
16
|
-
* 未识别的扩展名归类为 'file'。
|
|
17
|
-
*/
|
|
18
|
-
export function inferPayloadType(filename) {
|
|
19
|
-
const ext = path.extname(filename).toLowerCase();
|
|
20
|
-
return EXT_TYPE_MAP[ext] ?? 'file';
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* 校验显式传入的 --as 值。
|
|
24
|
-
*/
|
|
25
|
-
export function isValidPayloadType(value) {
|
|
26
|
-
return value === 'image' || value === 'video' || value === 'voice' || value === 'file';
|
|
27
|
-
}
|
package/dist/aun/rpc/caller.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { createShortConnection } from './connection.js';
|
|
2
|
-
export async function rpcCall(aid, method, params, opts) {
|
|
3
|
-
const conn = await createShortConnection(aid, opts);
|
|
4
|
-
try {
|
|
5
|
-
const result = await conn.call(method, params);
|
|
6
|
-
return { ok: true, result };
|
|
7
|
-
}
|
|
8
|
-
catch (e) {
|
|
9
|
-
if (e.code !== undefined && e.message !== undefined) {
|
|
10
|
-
return { ok: false, error: { code: e.code, message: e.message, data: e.data } };
|
|
11
|
-
}
|
|
12
|
-
return { ok: false, error: { code: -1, message: String(e.message || e) } };
|
|
13
|
-
}
|
|
14
|
-
finally {
|
|
15
|
-
await conn.close();
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export async function rpcBatch(aid, calls, opts) {
|
|
19
|
-
const conn = await createShortConnection(aid, opts);
|
|
20
|
-
const results = [];
|
|
21
|
-
try {
|
|
22
|
-
for (const { method, params } of calls) {
|
|
23
|
-
try {
|
|
24
|
-
const result = await conn.call(method, params);
|
|
25
|
-
results.push({ ok: true, result });
|
|
26
|
-
}
|
|
27
|
-
catch (e) {
|
|
28
|
-
if (e.code !== undefined && e.message !== undefined) {
|
|
29
|
-
results.push({ ok: false, error: { code: e.code, message: e.message, data: e.data } });
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
results.push({ ok: false, error: { code: -1, message: String(e.message || e) } });
|
|
33
|
-
}
|
|
34
|
-
break; // stop on first failure
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
finally {
|
|
39
|
-
await conn.close();
|
|
40
|
-
}
|
|
41
|
-
return results;
|
|
42
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { getAidStore, loadClient, SLOT } from '../aid/store.js';
|
|
2
|
-
export async function createShortConnection(aid, opts) {
|
|
3
|
-
const store = await getAidStore({ slotId: opts?.slotId ?? SLOT.cli, aunPath: opts?.aunPath });
|
|
4
|
-
try {
|
|
5
|
-
const client = await loadClient(store, aid);
|
|
6
|
-
await client.connect({ connection_kind: 'short', short_ttl_ms: 30000, auto_reconnect: false });
|
|
7
|
-
return {
|
|
8
|
-
async call(method, params) {
|
|
9
|
-
return client.call(method, params);
|
|
10
|
-
},
|
|
11
|
-
async close() {
|
|
12
|
-
try {
|
|
13
|
-
await client.close();
|
|
14
|
-
}
|
|
15
|
-
finally {
|
|
16
|
-
store.close();
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
store.close();
|
|
23
|
-
throw e;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { rpcCall } from '../rpc/caller.js';
|
|
2
|
-
export async function storageLs(aid, prefix, opts) {
|
|
3
|
-
return rpcCall(aid, 'storage.list_objects', { prefix: prefix || '' }, { aunPath: opts?.aunPath });
|
|
4
|
-
}
|
|
5
|
-
export async function storageRm(aid, remotePath, opts) {
|
|
6
|
-
return rpcCall(aid, 'storage.delete_object', { object_key: remotePath }, { aunPath: opts?.aunPath });
|
|
7
|
-
}
|
|
8
|
-
export async function storageQuota(aid, opts) {
|
|
9
|
-
return rpcCall(aid, 'storage.get_quota', {}, { aunPath: opts?.aunPath });
|
|
10
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { isValidAid } from '../aun/aid/validation.js';
|
|
2
|
-
export function validAgentOwnerIds(agent) {
|
|
3
|
-
return [...new Set((agent?.owners ?? [])
|
|
4
|
-
.map(value => String(value || '').trim())
|
|
5
|
-
.filter(isValidAid))];
|
|
6
|
-
}
|
|
7
|
-
export function validateAccessPolicyDomain(selfAid, agent) {
|
|
8
|
-
const access = agent.access;
|
|
9
|
-
if (!access)
|
|
10
|
-
return undefined;
|
|
11
|
-
if (access.policyMode !== 'open' && validAgentOwnerIds(agent).length === 0) {
|
|
12
|
-
return {
|
|
13
|
-
code: 'restricted_mode_without_owner',
|
|
14
|
-
message: `Agent ${selfAid} cannot use ${access.policyMode} without an Owner`,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { normalizeCliArgv } from '../cli/cli-argv.js';
|
|
2
|
-
export function splitConfigBatchGetArgv(inputArgv) {
|
|
3
|
-
const argv = normalizeCliArgv(inputArgv);
|
|
4
|
-
if (argv[0] !== 'config' || argv[1] !== 'get')
|
|
5
|
-
return null;
|
|
6
|
-
const fields = [];
|
|
7
|
-
let i = 2;
|
|
8
|
-
for (; i < argv.length && !argv[i].startsWith('-'); i++)
|
|
9
|
-
fields.push(argv[i]);
|
|
10
|
-
return { fields, rest: argv.slice(i) };
|
|
11
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { pathToFileURL } from 'url';
|
|
3
|
-
import { getPackageRoot, resolvePaths } from '../paths.js';
|
|
4
|
-
import { assertRoleConfigV4Ready, ConfigError } from './config-manager.js';
|
|
5
|
-
/**
|
|
6
|
-
* Automatically applies the one-off role config migration before daemon startup.
|
|
7
|
-
* The migration script owns backup, validation, atomic writes, rollback, and locking.
|
|
8
|
-
*/
|
|
9
|
-
export async function ensureRoleConfigV4OnStartup() {
|
|
10
|
-
try {
|
|
11
|
-
assertRoleConfigV4Ready();
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
catch (error) {
|
|
15
|
-
if (!(error instanceof ConfigError) || error.code !== 'ROLE_CONFIG_MIGRATION_REQUIRED')
|
|
16
|
-
throw error;
|
|
17
|
-
}
|
|
18
|
-
const home = resolvePaths().root;
|
|
19
|
-
const script = path.join(getPackageRoot(), 'kits', 'migrations', 'migrate-role-config-v4.mjs');
|
|
20
|
-
try {
|
|
21
|
-
const migration = await import(pathToFileURL(script).href);
|
|
22
|
-
const result = migration.runMigration({ home, apply: true });
|
|
23
|
-
assertRoleConfigV4Ready();
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
const detail = error instanceof Error ? error.message : String(error);
|
|
28
|
-
throw new ConfigError('ROLE_CONFIG_MIGRATION_FAILED', `Automatic role config v4 migration failed: ${detail}\n` +
|
|
29
|
-
`Fix the reported config or run manually:\n` +
|
|
30
|
-
`node kits/migrations/migrate-role-config-v4.mjs --apply --home ${JSON.stringify(home)}`, { cause: error });
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { pathToFileURL } from 'url';
|
|
3
|
-
import { getPackageRoot, resolvePaths } from '../paths.js';
|
|
4
|
-
import { assertRoleConfigV5Ready, ConfigError } from './config-manager.js';
|
|
5
|
-
export async function ensureRoleConfigV5OnStartup() {
|
|
6
|
-
try {
|
|
7
|
-
assertRoleConfigV5Ready();
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
catch (error) {
|
|
11
|
-
if (!(error instanceof ConfigError) || error.code !== 'ROLE_CONFIG_V5_MIGRATION_REQUIRED')
|
|
12
|
-
throw error;
|
|
13
|
-
}
|
|
14
|
-
const home = resolvePaths().root;
|
|
15
|
-
const script = path.join(getPackageRoot(), 'kits', 'migrations', 'migrate-role-config-v5.mjs');
|
|
16
|
-
try {
|
|
17
|
-
const migration = await import(pathToFileURL(script).href);
|
|
18
|
-
const result = migration.runMigration({ home, apply: true });
|
|
19
|
-
assertRoleConfigV5Ready();
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
const detail = error instanceof Error ? error.message : String(error);
|
|
24
|
-
throw new ConfigError('ROLE_CONFIG_V5_MIGRATION_FAILED', `Automatic standalone role migration failed: ${detail}\n` +
|
|
25
|
-
`node kits/migrations/migrate-role-config-v5.mjs --apply --home ${JSON.stringify(home)}`, { cause: error });
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const CROSS_AGENT_READ_OPERATIONS = new Set([
|
|
2
|
-
'trigger.list',
|
|
3
|
-
'trigger.show',
|
|
4
|
-
'trigger.history',
|
|
5
|
-
]);
|
|
6
|
-
export function isCrossAgentTriggerOperationAllowed(input) {
|
|
7
|
-
if (input.control || input.taskAgentAid === input.targetAgentAid)
|
|
8
|
-
return true;
|
|
9
|
-
if (!input.taskAgentAid || !input.targetManagement)
|
|
10
|
-
return false;
|
|
11
|
-
return CROSS_AGENT_READ_OPERATIONS.has(input.operation);
|
|
12
|
-
}
|
|
13
|
-
export function isCrossAgentTriggerReadOperation(operation) {
|
|
14
|
-
return CROSS_AGENT_READ_OPERATIONS.has(operation);
|
|
15
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { loadDaemonConfig } from '../../config-store.js';
|
|
2
|
-
import { readInstalledEvolcoreVersion } from '../../utils/evolcore-version.js';
|
|
3
|
-
import { compareStableSemver, parseStableSemver } from '../../utils/stable-semver.js';
|
|
4
|
-
export function evaluateEvolMenuVersionGate(input) {
|
|
5
|
-
const minimum = loadDaemonConfig().aun?.minEvolVersion;
|
|
6
|
-
if (!minimum)
|
|
7
|
-
return null;
|
|
8
|
-
const minimumVersion = parseStableSemver(minimum);
|
|
9
|
-
if (!minimumVersion) {
|
|
10
|
-
throw new Error('daemon.json.aun.minEvolVersion must use stable X.Y.Z format');
|
|
11
|
-
}
|
|
12
|
-
const received = input.protectedHeaders?.evol_version;
|
|
13
|
-
const receivedVersion = input.encrypted ? parseStableSemver(received) : null;
|
|
14
|
-
if (!receivedVersion || compareStableSemver(receivedVersion, minimumVersion) < 0) {
|
|
15
|
-
return {
|
|
16
|
-
code: 'UPGRADE_REQUIRED',
|
|
17
|
-
message: `Evol ${minimum} or later is required`,
|
|
18
|
-
data: {
|
|
19
|
-
minimum,
|
|
20
|
-
received: receivedVersion ? received : null,
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
export function isEvolMenuVersionGateEnabled() {
|
|
27
|
-
return loadDaemonConfig().aun?.minEvolVersion !== undefined;
|
|
28
|
-
}
|
|
29
|
-
/** Token may be issued while disabled, but only this flag makes it an access requirement. */
|
|
30
|
-
export function isAunMenuTokenRequired() {
|
|
31
|
-
return loadDaemonConfig().aun?.menuTokenRequired === true;
|
|
32
|
-
}
|
|
33
|
-
export function evolMenuResponseTransportMetadata() {
|
|
34
|
-
return {
|
|
35
|
-
// Clear inherited request state so AUNChannel applies daemon aun.defaultEncrypt.
|
|
36
|
-
encrypted: undefined,
|
|
37
|
-
protectedHeaders: { ec_version: readInstalledEvolcoreVersion() },
|
|
38
|
-
};
|
|
39
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/** Bind an adapter response to its runtime-owned channel identity domain. */
|
|
2
|
-
export function registerAdapterInteractions(adapter, router) {
|
|
3
|
-
const channelKey = adapter.channelKey;
|
|
4
|
-
adapter.onInteraction?.(async (response) => {
|
|
5
|
-
return router.handleAsync({ ...response, channelKey });
|
|
6
|
-
});
|
|
7
|
-
adapter.onInteractionInvalidated?.((interactionId, reason) => {
|
|
8
|
-
return router.cancelFromChannel(interactionId, reason);
|
|
9
|
-
});
|
|
10
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { normalizePermissionMode } from './mode.js';
|
|
2
|
-
/**
|
|
3
|
-
* Phase one only disables the task execution sandbox for an authenticated
|
|
4
|
-
* owner running in bypass mode. Every other combination remains fail-closed.
|
|
5
|
-
*/
|
|
6
|
-
export function resolvePhaseOneExecutionSandbox(permissionMode, role) {
|
|
7
|
-
const normalizedMode = normalizePermissionMode(permissionMode).mode;
|
|
8
|
-
const normalizedRole = role ?? undefined;
|
|
9
|
-
const sandboxOff = normalizedMode === 'bypass' && normalizedRole === 'owner';
|
|
10
|
-
return {
|
|
11
|
-
permissionMode: normalizedMode,
|
|
12
|
-
role: normalizedRole,
|
|
13
|
-
state: sandboxOff ? 'off' : 'active',
|
|
14
|
-
reason: sandboxOff ? 'owner-bypass' : 'phase-one-required',
|
|
15
|
-
};
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './peer-identity.js';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* sessionKey: agent 内部会话路由键。
|
|
3
|
-
* 格式: channelType#urlEncode(channelId)#urlEncode(threadId)
|
|
4
|
-
* 无话题时 threadId 固定为 'main'。
|
|
5
|
-
*/
|
|
6
|
-
export const DEFAULT_THREAD_ID = 'main';
|
|
7
|
-
export function formatSessionKey(channelType, channelId, threadId) {
|
|
8
|
-
const tid = threadId || DEFAULT_THREAD_ID;
|
|
9
|
-
return `${channelType}#${encodeURIComponent(channelId)}#${encodeURIComponent(tid)}`;
|
|
10
|
-
}
|
|
11
|
-
export function parseSessionKey(key) {
|
|
12
|
-
const first = key.indexOf('#');
|
|
13
|
-
if (first <= 0)
|
|
14
|
-
throw new Error(`Invalid session key: ${key}`);
|
|
15
|
-
const rest = key.slice(first + 1);
|
|
16
|
-
const second = rest.indexOf('#');
|
|
17
|
-
if (second <= 0)
|
|
18
|
-
throw new Error(`Invalid session key (missing threadId): ${key}`);
|
|
19
|
-
return {
|
|
20
|
-
channelType: key.slice(0, first),
|
|
21
|
-
channelId: decodeURIComponent(rest.slice(0, second)),
|
|
22
|
-
threadId: decodeURIComponent(rest.slice(second + 1)),
|
|
23
|
-
};
|
|
24
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export const BASEAGENT_CAPS = {
|
|
2
|
-
'claude-code': {
|
|
3
|
-
autoLoadsRules: true,
|
|
4
|
-
supportsSystemPrompt: true,
|
|
5
|
-
},
|
|
6
|
-
'claude': {
|
|
7
|
-
autoLoadsRules: true,
|
|
8
|
-
supportsSystemPrompt: true,
|
|
9
|
-
},
|
|
10
|
-
'codex': {
|
|
11
|
-
autoLoadsRules: false,
|
|
12
|
-
supportsSystemPrompt: true,
|
|
13
|
-
},
|
|
14
|
-
'gemini': {
|
|
15
|
-
autoLoadsRules: false,
|
|
16
|
-
supportsSystemPrompt: true,
|
|
17
|
-
},
|
|
18
|
-
};
|