evolcore 0.0.2 → 0.0.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/CHANGELOG.md +93 -778
- package/README.md +45 -10
- package/bin/ec-safe-output.js +89 -24
- package/dist/agents/baseagent.js +46 -0
- package/dist/agents/claude-runner.js +198 -48
- package/dist/agents/codex-app-server-client.js +68 -0
- package/dist/agents/codex-runner.js +203 -8
- package/dist/agents/runner-types.js +2 -2
- package/dist/aun/aid/agentmd.js +79 -0
- package/dist/aun/aid/encryption-seed-policy.js +29 -0
- package/dist/aun/aid/index.js +1 -1
- package/dist/aun/aid/store.js +2 -5
- package/dist/aun/outbox.js +8 -0
- package/dist/channels/aun.js +241 -116
- package/dist/channels/daemon.js +18 -4
- package/dist/channels/dingtalk.js +1005 -260
- package/dist/channels/feishu.js +184 -56
- package/dist/channels/qqbot.js +23 -1
- package/dist/channels/wechat.js +303 -155
- package/dist/channels/wecom.js +1132 -164
- package/dist/cli/agent-command.js +2 -1
- package/dist/cli/aun-commands.js +98 -43
- package/dist/cli/bench.js +2 -2
- package/dist/cli/contact.js +71 -0
- package/dist/cli/ctl-command.js +2 -2
- package/dist/cli/daemon-commands.js +77 -214
- package/dist/cli/handoff-command.js +4 -3
- package/dist/cli/help.js +9 -5
- package/dist/cli/index.js +132 -116
- package/dist/cli/init-channel.js +242 -129
- package/dist/cli/init.js +70 -31
- package/dist/cli/model.js +2 -1
- package/dist/cli/net-check.js +2 -2
- package/dist/cli/queue-command.js +30 -6
- package/dist/cli/raw-key-input.js +25 -0
- package/dist/cli/response.js +5 -6
- package/dist/cli/restart-monitor.js +25 -1
- package/dist/cli/stats.js +6 -4
- package/dist/cli/trigger-command.js +146 -25
- package/dist/cli/version.js +6 -1
- package/dist/config/access-policy-domain.js +38 -0
- package/dist/config/access-policy.js +134 -0
- package/dist/config/builtin-role-templates.js +42 -17
- package/dist/config/builtin-roles.js +31 -6
- package/dist/config/config-field-policy.js +17 -5
- package/dist/config/config-manager.js +409 -29
- package/dist/config/config-operation-service.js +35 -38
- package/dist/config/contact-alias.js +68 -0
- package/dist/config/contact-bind-code.js +274 -0
- package/dist/config/contact-book-store.js +622 -0
- package/dist/config/contact-book-v2-startup.js +35 -0
- package/dist/config/contact-book.js +185 -300
- package/dist/config/contact-operation-service.js +116 -0
- package/dist/config/contact-request-service.js +331 -0
- package/dist/config/peer-role-resolver.js +136 -55
- package/dist/config/role-ranks.js +18 -0
- package/dist/config/role-service.js +16 -19
- package/dist/config/role-store.js +16 -5
- package/dist/config/roles.js +10 -1
- package/dist/config/schema-registry.js +49 -24
- package/dist/config-store.js +14 -4
- package/dist/core/auth/agent-delegation.js +105 -11
- package/dist/core/auth/authorization-audit.js +16 -1
- package/dist/core/auth/operation-authorizer.js +10 -0
- package/dist/core/auth/operation-catalog.js +105 -1
- package/dist/core/auth/trigger-authorization.js +15 -0
- package/dist/core/bootstrap-service.js +2 -9
- package/dist/core/channel-loader.js +6 -2
- package/dist/core/command/command-handler.js +113 -21
- package/dist/core/command/connect-menu.js +599 -0
- package/dist/core/command/evol-menu-version-gate.js +38 -0
- package/dist/core/command/group-menu.js +421 -0
- package/dist/core/command/menu-handler.js +382 -100
- package/dist/core/command/menu-protocol.js +8 -2
- package/dist/core/command/menu-token-store.js +102 -0
- package/dist/core/command/role-menu.js +128 -29
- package/dist/core/command/slash-gate.js +1 -1
- package/dist/core/command/slash-handler.js +186 -49
- package/dist/core/daemon-file-cache.js +40 -6
- package/dist/core/event-catalog.js +99 -0
- package/dist/core/evolagent-registry.js +4 -40
- package/dist/core/evolagent.js +20 -9
- package/dist/core/handoff/runtime.js +162 -37
- package/dist/core/handoff/store.js +46 -2
- package/dist/core/handoff/types.js +1 -0
- package/dist/core/inference/text-inference.js +16 -74
- package/dist/core/message/file-markers.js +7 -0
- package/dist/core/message/im-renderer.js +20 -14
- package/dist/core/message/inbound-admission.js +124 -0
- package/dist/core/message/message-bridge.js +670 -57
- package/dist/core/message/message-log.js +1 -0
- package/dist/core/message/message-queue.js +195 -10
- package/dist/core/message/message-utils.js +8 -2
- package/dist/core/message/peer-mode.js +7 -8
- package/dist/core/message/response-engine.js +642 -96
- package/dist/core/message/send-receipt.js +24 -0
- package/dist/core/message/stream-debouncer.js +11 -2
- package/dist/core/permission/approval-gateway.js +17 -10
- package/dist/core/permission/ec-command-parser.js +101 -46
- package/dist/core/permission/tool-policy.js +115 -38
- package/dist/core/protected-paths.js +38 -11
- package/dist/core/session/session-fs-store.js +44 -3
- package/dist/core/session/session-manager.js +86 -8
- package/dist/core/session/session-mapper.js +2 -0
- package/dist/core/session/session-renew.js +125 -69
- package/dist/core/session/session-turn-coordinator.js +5 -1
- package/dist/eck/kit-renderer.js +12 -1
- package/dist/eck/message-renderer.js +79 -1
- package/dist/index.js +285 -94
- package/dist/ipc.js +114 -8
- package/dist/paths.js +3 -0
- package/dist/response-system/config-resolver.js +29 -0
- package/dist/response-system/coordinator.js +8 -32
- package/dist/response-system/engines/v1/proactive-flow.js +1 -1
- package/dist/response-system/index.js +1 -0
- package/dist/response-system/modes/single-session/index.js +7 -4
- package/dist/stats/billing.js +20 -8
- package/dist/trigger/manager.js +3 -0
- package/dist/trigger/parser.js +126 -11
- package/dist/trigger/patch.js +12 -2
- package/dist/trigger/scheduler.js +444 -40
- package/dist/trigger/validation.js +13 -0
- package/dist/utils/aid-bind.js +43 -29
- package/dist/utils/error-dict.json +7 -0
- package/dist/utils/evolcore-version.js +21 -0
- package/dist/utils/instance-registry.js +14 -7
- package/dist/utils/log-writer.js +46 -0
- package/dist/utils/logger.js +2 -2
- package/dist/utils/media-cache.js +4 -1
- package/dist/utils/model-prices.jsonl +6 -3
- package/dist/utils/restart-safety.js +31 -0
- package/dist/utils/stable-semver.js +21 -0
- package/dist/utils/stats.js +33 -9
- package/dist/utils/system-memory.js +62 -0
- package/kits/docs/INDEX.md +2 -1
- package/kits/docs/channels/aun.md +4 -13
- package/kits/docs/evolcore/INDEX.md +5 -3
- package/kits/docs/evolcore/agent.md +9 -1
- package/kits/docs/evolcore/aid.md +5 -2
- package/kits/docs/evolcore/config.md +47 -2
- package/kits/docs/evolcore/contact.md +61 -0
- package/kits/docs/evolcore/fs.md +9 -0
- package/kits/docs/evolcore/group-rules.md +46 -4
- package/kits/docs/evolcore/group.md +15 -6
- package/kits/docs/evolcore/model.md +4 -1
- package/kits/docs/evolcore/msg.md +12 -6
- package/kits/docs/evolcore/response.md +16 -21
- package/kits/docs/evolcore/rpc.md +2 -0
- package/kits/docs/evolcore/stats.md +15 -2
- package/kits/docs/evolcore/storage.md +1 -0
- package/kits/docs/evolcore/trigger.md +42 -10
- package/kits/docs/path-registry.md +36 -17
- package/kits/eck_manifest.json +12 -0
- package/kits/eck_message_manifest.json +12 -1
- package/kits/migrations/migrate-contact-book-v2.mjs +754 -0
- package/kits/rules/01-overview.md +17 -7
- package/kits/rules/02-navigation.md +38 -18
- package/kits/rules/03-identity.md +28 -24
- package/kits/rules/04-relation.md +44 -28
- package/kits/rules/05-venue.md +31 -15
- package/kits/rules/06-channel.md +11 -7
- package/kits/schemas/_meta.json +21 -7
- package/kits/schemas/agent-config.schema.6.json +322 -0
- package/kits/schemas/agent-config.schema.7.json +303 -0
- package/kits/schemas/agent-config.schema.8.json +304 -0
- package/kits/schemas/agent-config.schema.9.json +374 -0
- package/kits/schemas/contact-book.schema.2.json +43 -0
- package/kits/schemas/contact-book.schema.3.json +67 -0
- package/kits/schemas/daemon.schema.1.json +3 -2
- package/kits/schemas/daemon.schema.2.json +101 -0
- package/kits/schemas/daemon.schema.3.json +123 -0
- package/kits/schemas/defaults.schema.2.json +85 -0
- package/kits/schemas/defaults.schema.3.json +73 -0
- package/kits/schemas/relation-config.schema.5.json +47 -0
- package/kits/schemas/relation-config.schema.6.json +46 -0
- package/kits/schemas/relation-config.schema.7.json +59 -0
- package/kits/schemas/role-config.schema.1.json +1 -0
- package/kits/schemas/role-registry.schema.1.json +2 -2
- package/kits/schemas/single-session.schema.2.json +57 -0
- package/kits/templates/message-fragments/handoff-context-to-target.md +9 -0
- package/kits/templates/message-fragments/handoff-request-to-target.md +14 -8
- package/kits/templates/message-fragments/handoff-response-to-origin.md +5 -6
- package/kits/templates/roles/admin.json +47 -0
- package/kits/templates/roles/member.json +5 -0
- package/kits/templates/roles/owner.json +1 -0
- package/kits/templates/roles/visitor.json +5 -0
- package/kits/templates/system-fragments/channel.md +12 -2
- package/kits/templates/system-fragments/commands.md +3 -1
- package/kits/templates/system-fragments/identity.md +3 -1
- package/kits/templates/system-fragments/relation.md +1 -1
- package/kits/templates/system-fragments/session.md +6 -2
- package/package.json +7 -5
- package/MIGRATION-0.5.0.md +0 -378
- package/ROLE_ACCESS_CONTROL.md +0 -174
- package/assets/brand/evolcore/README.md +0 -19
- package/assets/brand/evolcore/evolcore-app-icon.png +0 -0
- package/assets/brand/evolcore/evolcore-app-icon.svg +0 -13
- package/assets/brand/evolcore/evolcore-brand-board.png +0 -0
- package/assets/brand/evolcore/evolcore-brand-board.svg +0 -126
- package/assets/brand/evolcore/evolcore-logo-kit.zip +0 -0
- package/assets/brand/evolcore/evolcore-logo-reverse.png +0 -0
- package/assets/brand/evolcore/evolcore-logo-reverse.svg +0 -14
- package/assets/brand/evolcore/evolcore-logo.png +0 -0
- package/assets/brand/evolcore/evolcore-logo.svg +0 -14
- package/assets/brand/evolcore/evolcore-mark.png +0 -0
- package/assets/brand/evolcore/evolcore-mark.svg +0 -10
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { readBuiltinRoleTemplate } from './builtin-role-templates.js';
|
|
2
|
+
import { expectedRoleRank } from './role-ranks.js';
|
|
3
|
+
export { expectedRoleRank, ROLE_RANKS } from './role-ranks.js';
|
|
2
4
|
export const BUILTIN_USER_ROLES = ['member', 'visitor'];
|
|
3
5
|
export const MANAGEMENT_ROLES = ['owner', 'admin'];
|
|
4
6
|
export function isManagementRole(role) {
|
|
@@ -19,15 +21,23 @@ export function getBuiltinRolesConfig() {
|
|
|
19
21
|
};
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
|
-
* Management grants are a code-level ceiling
|
|
23
|
-
*
|
|
24
|
+
* Management grants are a code-level ceiling. The built-in admin template
|
|
25
|
+
* declares the default grants; local role files may narrow them but can never
|
|
26
|
+
* add a grant outside this ceiling.
|
|
24
27
|
*/
|
|
25
|
-
export function getManagementCommandPermissions(
|
|
28
|
+
export function getManagementCommandPermissions(role) {
|
|
26
29
|
return {
|
|
30
|
+
'contact.read': { allow: true, scopes: ['agent'] },
|
|
31
|
+
'contact.block': { allow: true, scopes: ['agent'], constraints: { requireAgentAdmin: true } },
|
|
32
|
+
'connect.write': { allow: true, scopes: ['agent'], constraints: { requireAgentAdmin: true } },
|
|
33
|
+
'connect.access.write': { allow: true, scopes: ['agent'], constraints: { requireAgentOwner: true } },
|
|
27
34
|
'role.assign': { allow: true, scopes: ['agent'] },
|
|
28
35
|
'role.revoke': { allow: true, scopes: ['agent'] },
|
|
29
36
|
'role.policy.read': { allow: true, scopes: ['agent'] },
|
|
30
37
|
'role.relation.read': { allow: true, scopes: ['agent'] },
|
|
38
|
+
'config.get': { allow: true, scopes: ['agent', 'relation'] },
|
|
39
|
+
'config.set': { allow: true, scopes: ['agent', 'relation'] },
|
|
40
|
+
'config.unset': { allow: true, scopes: ['agent', 'relation'] },
|
|
31
41
|
'role.policy.write': { allow: true, dangerous: true, scopes: ['agent'], constraints: { requireAgentAdmin: true } },
|
|
32
42
|
'*': { allow: true },
|
|
33
43
|
'agent.reload': { allow: true, dangerous: true, scopes: ['agent'], constraints: { targetCurrentAgentOnly: true, requireAgentAdmin: true } },
|
|
@@ -35,19 +45,26 @@ export function getManagementCommandPermissions(_role) {
|
|
|
35
45
|
};
|
|
36
46
|
}
|
|
37
47
|
export function applyManagementRoleCeiling(role, configured) {
|
|
48
|
+
const builtin = readBuiltinRoleTemplate(role).definition;
|
|
38
49
|
const fallback = {
|
|
39
50
|
description: role === 'owner' ? 'Agent owner' : 'Agent administrator',
|
|
51
|
+
rank: expectedRoleRank(role),
|
|
40
52
|
allowAccess: true,
|
|
41
53
|
permissions: {
|
|
42
54
|
permissionMode: { default: 'request', allowOverride: false },
|
|
43
55
|
},
|
|
44
56
|
commandPermissions: getManagementCommandPermissions(role),
|
|
45
57
|
};
|
|
46
|
-
const policy = configured ??
|
|
58
|
+
const policy = configured ?? builtin ?? fallback;
|
|
59
|
+
const configuredCommandPermissions = policy.commandPermissions;
|
|
60
|
+
const defaultCommandPermissions = configuredCommandPermissions
|
|
61
|
+
?? (role === 'admin' && builtin ? builtin.commandPermissions : undefined)
|
|
62
|
+
?? getManagementCommandPermissions(role);
|
|
47
63
|
return {
|
|
48
64
|
...policy,
|
|
49
|
-
|
|
50
|
-
|
|
65
|
+
rank: expectedRoleRank(role),
|
|
66
|
+
allowAccess: role === 'owner' ? true : policy.allowAccess !== false,
|
|
67
|
+
commandPermissions: narrowManagementCommandPermissions(getManagementCommandPermissions(role), defaultCommandPermissions),
|
|
51
68
|
};
|
|
52
69
|
}
|
|
53
70
|
export function getManagementRoleDefinition(role) {
|
|
@@ -72,6 +89,14 @@ function narrowManagementCommandPermissions(ceiling, configured) {
|
|
|
72
89
|
else if (!Array.isArray(permission.scopes) && Array.isArray(override.scopes)) {
|
|
73
90
|
next.scopes = [...override.scopes];
|
|
74
91
|
}
|
|
92
|
+
if (permission.constraints || override.constraints) {
|
|
93
|
+
// Configured constraints may add restrictions, but a role file cannot
|
|
94
|
+
// weaken a code-level constraint (the ceiling wins on collisions).
|
|
95
|
+
next.constraints = {
|
|
96
|
+
...(override.constraints ?? {}),
|
|
97
|
+
...(permission.constraints ?? {}),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
75
100
|
merged[operation] = next;
|
|
76
101
|
}
|
|
77
102
|
// Exact or namespace denies may narrow grants inherited through the ceiling's
|
|
@@ -8,6 +8,7 @@ const BEHAVIOR_TOP_FIELDS = new Set([
|
|
|
8
8
|
'debounce',
|
|
9
9
|
'show_activities',
|
|
10
10
|
'session_renew',
|
|
11
|
+
'groupRules',
|
|
11
12
|
'group_venue_sync',
|
|
12
13
|
'render',
|
|
13
14
|
'sessionManifests',
|
|
@@ -32,6 +33,7 @@ const SENSITIVE_TOP_FIELDS = new Set([
|
|
|
32
33
|
'lifecycle',
|
|
33
34
|
'initialized',
|
|
34
35
|
'owners',
|
|
36
|
+
'access',
|
|
35
37
|
'admins',
|
|
36
38
|
'channels',
|
|
37
39
|
'aun',
|
|
@@ -44,10 +46,10 @@ const SENSITIVE_TOP_FIELDS = new Set([
|
|
|
44
46
|
'role',
|
|
45
47
|
'extra_backup',
|
|
46
48
|
]);
|
|
47
|
-
const CRITICAL_AGENT_FIELDS = new Set(['owners', 'admins', 'roles']);
|
|
49
|
+
const CRITICAL_AGENT_FIELDS = new Set(['owners', 'admins', 'roles', 'access']);
|
|
48
50
|
const EFFORTS = new Set(['low', 'medium', 'high', 'xhigh', 'max']);
|
|
49
|
-
function scalar(rolePermissionKey, valueKind) {
|
|
50
|
-
return { class: 'safe-scalar', rolePermissionKey, valueKind };
|
|
51
|
+
function scalar(rolePermissionKey, valueKind, access = 'role-overridable') {
|
|
52
|
+
return { class: 'safe-scalar', access, rolePermissionKey, valueKind };
|
|
51
53
|
}
|
|
52
54
|
function readonlyObject(rolePermissionKey) {
|
|
53
55
|
return { class: 'safe-readonly-object', rolePermissionKey };
|
|
@@ -133,8 +135,6 @@ export function resolveConfigFieldRule(fieldPath) {
|
|
|
133
135
|
return scalar('session_renew', 'boolean');
|
|
134
136
|
if (parts[1] === 'after_hours')
|
|
135
137
|
return scalar('session_renew', 'positive-number');
|
|
136
|
-
if (parts[1] === 'effort')
|
|
137
|
-
return scalar('session_renew', 'effort');
|
|
138
138
|
if (parts[1] === 'fallback_action')
|
|
139
139
|
return scalar('session_renew', 'session-renew-action');
|
|
140
140
|
return { class: 'unknown' };
|
|
@@ -153,6 +153,14 @@ export function resolveConfigFieldRule(fieldPath) {
|
|
|
153
153
|
return scalar('sessionManifests', 'manifest-file');
|
|
154
154
|
return { class: 'unknown' };
|
|
155
155
|
}
|
|
156
|
+
if (top === 'groupRules') {
|
|
157
|
+
if (parts.length === 1)
|
|
158
|
+
return readonlyObject('groupRules');
|
|
159
|
+
if (field === 'groupRules.mode') {
|
|
160
|
+
return scalar(field, 'group-rules-mode', 'owner-only');
|
|
161
|
+
}
|
|
162
|
+
return { class: 'unknown' };
|
|
163
|
+
}
|
|
156
164
|
if (top === 'group_venue_sync')
|
|
157
165
|
return parts.length === 1
|
|
158
166
|
? readonlyObject('group_venue_sync')
|
|
@@ -257,5 +265,9 @@ export function parseConfigFieldValue(fieldPath, rawValue) {
|
|
|
257
265
|
return raw === 'continue' || raw === 'new'
|
|
258
266
|
? { ok: true, value: raw }
|
|
259
267
|
: { ok: false, reason: `Config field ${fieldPath} must be continue or new` };
|
|
268
|
+
case 'group-rules-mode':
|
|
269
|
+
return raw === 'load' || raw === 'ignore'
|
|
270
|
+
? { ok: true, value: raw }
|
|
271
|
+
: { ok: false, reason: `Config field ${fieldPath} must be load or ignore` };
|
|
260
272
|
}
|
|
261
273
|
}
|