evolcore 0.0.10 → 0.0.12
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/README.md +3 -3
- package/bin/codex-managed-hook.mjs +80 -0
- package/dist/agents/baseagent.js +4 -0
- package/dist/agents/claude-runner.js +158 -44
- package/dist/agents/codex-app-server-client.js +153 -23
- package/dist/agents/codex-runner.js +331 -43
- package/dist/agents/ecagent-runner.js +53 -6
- package/dist/agents/gemini-runner.js +1 -0
- package/dist/agents/request-identity.js +55 -0
- package/dist/aun/aid/client.js +11 -21
- package/dist/aun/aid/managed-operation.js +107 -0
- package/dist/aun/msg/group.js +81 -12
- package/dist/aun/msg/managed-operation.js +804 -0
- package/dist/aun/msg/mention-schema.js +20 -0
- package/dist/aun/msg/p2p.js +7 -0
- package/dist/aun/outbox.js +28 -31
- package/dist/channels/aun.js +418 -235
- package/dist/channels/daemon.js +13 -0
- package/dist/cli/agent-command.js +72 -17
- package/dist/cli/agent.js +249 -22
- package/dist/cli/aun-commands.js +270 -69
- package/dist/cli/bench.js +12 -3
- package/dist/cli/daemon-commands.js +52 -33
- package/dist/cli/fs-command.js +60 -0
- package/dist/cli/handoff-command.js +3 -0
- package/dist/cli/index.js +106 -63
- package/dist/cli/init-cancel.js +208 -0
- package/dist/cli/init-channel.js +343 -195
- package/dist/cli/init.js +21 -9
- package/dist/cli/managed-command-guard.js +41 -0
- package/dist/cli/model.js +11 -4
- package/dist/cli/queue-command.js +11 -1
- package/dist/cli/response.js +71 -0
- package/dist/cli/restart-monitor.js +4 -18
- package/dist/cli/trigger-command.js +4 -0
- package/dist/config/builtin-roles.js +5 -0
- package/dist/config/contact-book-store.js +11 -3
- package/dist/config/contact-request-service.js +161 -15
- package/dist/config/gateway-config.js +26 -10
- package/dist/config/mention-mode.js +8 -24
- package/dist/core/agent-reload-coordinator.js +53 -0
- package/dist/core/auth/agent-delegation.js +0 -1
- package/dist/core/auth/operation-authorizer.js +62 -154
- package/dist/core/auth/operation-catalog.js +264 -22
- package/dist/core/bootstrap-messages.js +68 -0
- package/dist/core/bootstrap-service.js +144 -10
- 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 +24 -7
- package/dist/core/command/agent-control.js +14 -11
- package/dist/core/command/cli-intent-parser.js +9 -0
- package/dist/core/command/command-handler.js +467 -6
- 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 +366 -0
- package/dist/core/command/menu-handler.js +213 -110
- package/dist/core/command/menu-protocol.js +71 -0
- package/dist/core/command/slash-gate.js +5 -2
- package/dist/core/command/slash-handler.js +45 -25
- package/dist/core/daemon-file-cache.js +2 -1
- package/dist/core/data-migration.js +9 -2
- package/dist/core/evolagent-registry.js +125 -35
- package/dist/core/evolagent.js +12 -5
- package/dist/core/handoff/dispatcher.js +5 -2
- package/dist/core/handoff/runtime.js +145 -21
- package/dist/core/handoff/store.js +24 -0
- package/dist/core/handoff/types.js +1 -0
- package/dist/core/inference/text-inference.js +38 -4
- 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 +237 -79
- package/dist/core/message/message-log.js +23 -0
- package/dist/core/message/message-queue.js +20 -4
- package/dist/core/message/response-engine.js +54 -36
- package/dist/core/model/model-catalog.js +143 -24
- package/dist/core/model/model-diagnostics.js +28 -10
- package/dist/core/permission/ec-command-parser.js +156 -10
- package/dist/core/permission/index.js +1 -0
- package/dist/core/permission/readonly-shell-query.js +532 -0
- package/dist/core/permission/sandbox-runtime.js +22 -1
- package/dist/core/permission/shell-environment.js +46 -0
- package/dist/core/permission/tool-policy.js +292 -111
- package/dist/core/protected-paths.js +17 -9
- package/dist/core/runner-reload-transaction.js +57 -0
- package/dist/core/session/session-manager.js +21 -2
- package/dist/eck/manifest-engine.js +39 -13
- package/dist/index.js +644 -180
- package/dist/ipc.js +246 -19
- 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/script-executor.js +1 -0
- package/dist/utils/aid-bind.js +3 -8
- 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/log-writer.js +6 -10
- package/dist/utils/logger.js +5 -5
- 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/msg.md +13 -0
- 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/rules/01-overview.md +9 -0
- package/kits/rules/04-relation.md +1 -1
- package/kits/rules/05-venue.md +2 -2
- package/kits/schemas/agent-config.schema.3.json +1 -1
- package/kits/schemas/agent-config.schema.4.json +1 -1
- package/kits/schemas/relation-config.schema.2.json +1 -1
- package/kits/schemas/role-config.schema.1.json +1 -1
- 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 +44 -0
- package/kits/templates/roles/visitor.json +40 -2
- package/kits/templates/system-fragments/bootstrap.md +12 -6
- package/kits/templates/system-fragments/channel.md +6 -0
- package/kits/templates/system-fragments/session.md +2 -0
- package/package.json +3 -2
- package/skills/eclink/SKILL.md +15 -3
- package/skills/eclink/agents/openai.yaml +3 -3
- package/dist/core/command/evol-menu-version-gate.js +0 -39
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { MentionSchemaError, normalizeMentionEntries, } from '../../core/message/mention-schema.js';
|
|
2
|
+
const AUN_MENTION_KEYS = new Set(['aid', 'scope', 'display', 'offset', 'length']);
|
|
3
|
+
/**
|
|
4
|
+
* Validate the AUN wire schema. `userId` is deliberately excluded here:
|
|
5
|
+
* it identifies users in platform-native adapters such as Feishu/DingTalk,
|
|
6
|
+
* while AUN addresses agents with `aid` and uses `scope: 'all'` for broadcast.
|
|
7
|
+
*/
|
|
8
|
+
export function normalizeAunMentionEntries(raw) {
|
|
9
|
+
const entries = normalizeMentionEntries(raw);
|
|
10
|
+
for (const [index, entry] of entries.entries()) {
|
|
11
|
+
if ('userId' in entry) {
|
|
12
|
+
throw new MentionSchemaError('userId is not valid in AUN mentions; use {aid: "..."}', index);
|
|
13
|
+
}
|
|
14
|
+
const unsupported = Object.keys(entry).find(key => !AUN_MENTION_KEYS.has(key));
|
|
15
|
+
if (unsupported) {
|
|
16
|
+
throw new MentionSchemaError(`${unsupported} is not valid AUN mention metadata`, index);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return entries;
|
|
20
|
+
}
|
package/dist/aun/msg/p2p.js
CHANGED
|
@@ -10,6 +10,7 @@ import { resolvePaths } from '../../paths.js';
|
|
|
10
10
|
import { ipcQuery } from '../../ipc.js';
|
|
11
11
|
import { AGENT_DELEGATION_TOKEN_ENV } from '../../core/auth/agent-delegation.js';
|
|
12
12
|
import { loadDaemonConfig } from '../../config-store.js';
|
|
13
|
+
import { normalizeAunMentionEntries } from './mention-schema.js';
|
|
13
14
|
const DEFAULT_TASK_EXECUTION_MS = 60 * 60 * 1000;
|
|
14
15
|
const DAEMON_SEND_TIMEOUT_GRACE_MS = 10_000;
|
|
15
16
|
const MAX_TIMER_MS = 2_147_483_647;
|
|
@@ -206,6 +207,9 @@ export async function msgSend(args) {
|
|
|
206
207
|
let payload;
|
|
207
208
|
if (args.body.mode !== 'file') {
|
|
208
209
|
payload = buildSimplePayload(args.body);
|
|
210
|
+
if (Object.prototype.hasOwnProperty.call(payload, 'mentions')) {
|
|
211
|
+
payload.mentions = normalizeAunMentionEntries(payload.mentions);
|
|
212
|
+
}
|
|
209
213
|
applyRoutingPayloadFields(payload, args, runtimeContext, false);
|
|
210
214
|
const daemonResult = await tryDaemonMsgSend(args, payload, runtimeContext);
|
|
211
215
|
if (daemonResult)
|
|
@@ -265,6 +269,9 @@ export async function msgSend(args) {
|
|
|
265
269
|
// 5. 写入 payload.thread_id/ref_message_id(如果指定)
|
|
266
270
|
applyRoutingPayloadFields(payload, args, runtimeContext, false);
|
|
267
271
|
applyRoutingPayloadFields(payload, args, runtimeContext);
|
|
272
|
+
if (Object.prototype.hasOwnProperty.call(payload, 'mentions')) {
|
|
273
|
+
payload.mentions = normalizeAunMentionEntries(payload.mentions);
|
|
274
|
+
}
|
|
268
275
|
const encrypt = resolveAunMessageEncrypt(args.encrypt);
|
|
269
276
|
const sendParams = { to: args.to, payload, encrypt };
|
|
270
277
|
const result = await conn.call('message.send', sendParams);
|
package/dist/aun/outbox.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
1
|
import crypto from 'crypto';
|
|
4
2
|
import { agentOutboxPath } from '../paths.js';
|
|
3
|
+
import { atomicRead, atomicWrite } from '../utils/atomic-write.js';
|
|
5
4
|
const MAX_ENTRIES_PER_AID = 20;
|
|
6
5
|
const DEFAULT_TTL = 300_000; // 5 minutes
|
|
7
6
|
function outboxFile(aid) {
|
|
@@ -13,14 +12,14 @@ function generateId() {
|
|
|
13
12
|
return `out-${ts}-${rand}`;
|
|
14
13
|
}
|
|
15
14
|
function isExpired(entry) {
|
|
15
|
+
if (entry.critical)
|
|
16
|
+
return false;
|
|
16
17
|
return Date.now() - entry.ts > entry.ttl;
|
|
17
18
|
}
|
|
18
19
|
function readEntries(aid) {
|
|
19
20
|
const file = outboxFile(aid);
|
|
20
|
-
if (!fs.existsSync(file))
|
|
21
|
-
return [];
|
|
22
21
|
try {
|
|
23
|
-
const content =
|
|
22
|
+
const content = atomicRead(file)?.trim();
|
|
24
23
|
if (!content)
|
|
25
24
|
return [];
|
|
26
25
|
return content.split('\n').map(line => {
|
|
@@ -38,22 +37,25 @@ function readEntries(aid) {
|
|
|
38
37
|
}
|
|
39
38
|
function writeEntries(aid, entries) {
|
|
40
39
|
const file = outboxFile(aid);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
catch { }
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
49
|
-
fs.writeFileSync(file, entries.map(e => JSON.stringify(e)).join('\n') + '\n');
|
|
40
|
+
const content = entries.length > 0
|
|
41
|
+
? entries.map(e => JSON.stringify(e)).join('\n') + '\n'
|
|
42
|
+
: '';
|
|
43
|
+
atomicWrite(file, content);
|
|
50
44
|
}
|
|
51
45
|
export function enqueue(aid, opts) {
|
|
46
|
+
const existingEntries = readEntries(aid);
|
|
47
|
+
if (opts.dedupeKey) {
|
|
48
|
+
const existing = existingEntries.find(entry => entry.dedupeKey === opts.dedupeKey && !isExpired(entry));
|
|
49
|
+
if (existing)
|
|
50
|
+
return existing;
|
|
51
|
+
}
|
|
52
52
|
const entry = {
|
|
53
53
|
id: generateId(),
|
|
54
54
|
ts: Date.now(),
|
|
55
55
|
aid,
|
|
56
56
|
channelId: opts.channelId,
|
|
57
|
+
dedupeKey: opts.dedupeKey,
|
|
58
|
+
critical: opts.critical,
|
|
57
59
|
type: opts.type,
|
|
58
60
|
contentKind: opts.contentKind,
|
|
59
61
|
payload: opts.payload,
|
|
@@ -65,17 +67,18 @@ export function enqueue(aid, opts) {
|
|
|
65
67
|
ttl: opts.ttl ?? DEFAULT_TTL,
|
|
66
68
|
postSend: opts.postSend,
|
|
67
69
|
};
|
|
68
|
-
const file = outboxFile(aid);
|
|
69
|
-
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
70
70
|
// Enforce cap: read existing, drop oldest if over limit
|
|
71
|
-
let entries =
|
|
72
|
-
if (entries.length >= MAX_ENTRIES_PER_AID) {
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
let entries = existingEntries;
|
|
72
|
+
if (entries.filter(candidate => !candidate.critical).length >= MAX_ENTRIES_PER_AID) {
|
|
73
|
+
const dropIndex = entries.findIndex(candidate => !candidate.critical);
|
|
74
|
+
if (dropIndex >= 0)
|
|
75
|
+
entries.splice(dropIndex, 1);
|
|
76
|
+
entries = [...entries, entry];
|
|
75
77
|
}
|
|
76
78
|
else {
|
|
77
|
-
|
|
79
|
+
entries = [...entries, entry];
|
|
78
80
|
}
|
|
81
|
+
writeEntries(aid, entries);
|
|
79
82
|
return entry;
|
|
80
83
|
}
|
|
81
84
|
export function remove(aid, id) {
|
|
@@ -105,6 +108,9 @@ export function removeInteractionCards(aid, requestId) {
|
|
|
105
108
|
export function load(aid) {
|
|
106
109
|
return readEntries(aid).filter(e => !isExpired(e));
|
|
107
110
|
}
|
|
111
|
+
export function findByDedupeKey(aid, dedupeKey) {
|
|
112
|
+
return load(aid).find(entry => entry.dedupeKey === dedupeKey);
|
|
113
|
+
}
|
|
108
114
|
export function cleanup(aid) {
|
|
109
115
|
const all = readEntries(aid);
|
|
110
116
|
const valid = all.filter(e => !isExpired(e));
|
|
@@ -185,16 +191,7 @@ export async function drain(aid, sender) {
|
|
|
185
191
|
}
|
|
186
192
|
}
|
|
187
193
|
export function hasPending(aid) {
|
|
188
|
-
|
|
189
|
-
if (!fs.existsSync(file))
|
|
190
|
-
return false;
|
|
191
|
-
try {
|
|
192
|
-
const stat = fs.statSync(file);
|
|
193
|
-
return stat.size > 0;
|
|
194
|
-
}
|
|
195
|
-
catch {
|
|
196
|
-
return false;
|
|
197
|
-
}
|
|
194
|
+
return readEntries(aid).some(entry => !isExpired(entry));
|
|
198
195
|
}
|
|
199
196
|
/**
|
|
200
197
|
* 当前 outbox 中待发送条目数。用于诊断发送管线堵塞:depth 持续增长说明
|