evolcore 0.0.19 → 0.0.21
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 +43 -1
- package/README.md +60 -9
- package/bin/install-codex-managed-hooks.mjs +61 -0
- package/dist/agents/baseagent.js +10 -6
- package/dist/agents/claude-runner.js +383 -111
- package/dist/agents/codex-app-server-client.js +10 -2
- package/dist/agents/codex-runner.js +405 -137
- package/dist/agents/ecagent-runner.js +174 -63
- package/dist/agents/gemini-runner.js +130 -30
- package/dist/agents/request-identity.js +25 -0
- package/dist/agents/runner-types.js +19 -0
- package/dist/aun/aid/agentmd.js +66 -2
- package/dist/aun/aid/identity.js +4 -1
- package/dist/aun/aid/index.js +1 -1
- package/dist/aun/msg/group.js +86 -9
- package/dist/aun/msg/history.js +213 -36
- package/dist/aun/msg/managed-operation.js +58 -9
- package/dist/aun/msg/p2p.js +26 -11
- package/dist/aun/outbox.js +295 -68
- package/dist/aun/service-proxy.js +43 -25
- package/dist/channels/aun.js +1004 -273
- package/dist/channels/daemon.js +6 -1
- package/dist/cli/agent-command.js +4 -3
- package/dist/cli/agent.js +66 -56
- package/dist/cli/aun-commands.js +177 -42
- package/dist/cli/command-log.js +10 -11
- package/dist/cli/contact.js +1 -0
- package/dist/cli/daemon-commands.js +81 -121
- package/dist/cli/index.js +1 -0
- package/dist/cli/init.js +76 -24
- package/dist/cli/restart-monitor.js +3 -3
- package/dist/cli/task-context.js +46 -0
- package/dist/cli/trigger-command.js +1 -1
- package/dist/cli/watch-logs.js +10 -3
- package/dist/config/builtin-roles.js +1 -0
- package/dist/config/config-field-policy.js +16 -5
- package/dist/config/config-manager.js +226 -24
- package/dist/config/config-operation-service.js +1 -2
- package/dist/config/contact-operation-service.js +32 -1
- package/dist/config/contact-request-service.js +44 -0
- package/dist/config/daemon-services.js +186 -0
- package/dist/config/gateway-config.js +29 -16
- package/dist/config/lifecycle.js +16 -5
- package/dist/config/role-service.js +54 -3
- package/dist/config/schema-migration.js +550 -0
- package/dist/config-store.js +161 -12
- package/dist/core/agent-application-service.js +279 -0
- package/dist/core/audit/log-integrity.js +102 -0
- package/dist/core/auth/agent-delegation.js +31 -1
- package/dist/core/auth/auth-gateway.js +33 -4
- package/dist/core/auth/authorization-audit.js +155 -4
- package/dist/core/auth/operation-authorizer.js +41 -1
- package/dist/core/auth/operation-catalog.js +9 -1
- package/dist/core/bootstrap-messages.js +2 -2
- package/dist/core/bootstrap-service.js +27 -38
- package/dist/core/causation/aun-association.js +7 -4
- package/dist/core/channel-loader.js +0 -2
- package/dist/core/command/agent-control.js +56 -16
- package/dist/core/command/command-handler.js +290 -44
- package/dist/core/command/connect-menu.js +3 -4
- package/dist/core/command/group-menu.js +5 -7
- package/dist/core/command/menu-handler.js +279 -80
- package/dist/core/command/role-menu.js +21 -11
- package/dist/core/command/slash-gate.js +85 -18
- package/dist/core/command/slash-handler.js +350 -32
- package/dist/core/event-catalog.js +5 -0
- package/dist/core/evolagent.js +9 -4
- package/dist/core/handoff/dispatcher.js +4 -0
- package/dist/core/handoff/runtime.js +10 -0
- package/dist/core/handoff/store.js +32 -9
- package/dist/core/inference/text-inference.js +7 -15
- package/dist/core/message/im-renderer.js +83 -84
- package/dist/core/message/{inbound-admission.js → message-admission.js} +51 -1
- package/dist/core/message/message-bridge.js +124 -10
- package/dist/core/message/message-log.js +14 -7
- package/dist/core/message/message-queue.js +206 -16
- package/dist/core/message/message-utils.js +12 -5
- package/dist/core/message/response-engine.js +495 -72
- package/dist/core/message/send-receipt.js +1 -0
- package/dist/core/message/stream-debouncer.js +9 -2
- package/dist/core/model/model-catalog.js +23 -15
- package/dist/core/model/model-diagnostics.js +28 -10
- package/dist/core/permission/approval-gateway.js +180 -6
- package/dist/core/permission/ec-command-parser.js +465 -56
- package/dist/core/permission/mode.js +18 -3
- package/dist/core/{protected-paths.js → permission/protected-paths.js} +17 -5
- package/dist/core/permission/readonly-shell-query.js +263 -9
- package/dist/core/permission/sandbox-runtime.js +205 -13
- package/dist/core/permission/tool-policy.js +673 -62
- package/dist/core/relation/peer-identity.js +18 -0
- package/dist/core/session/session-fs-store.js +154 -5
- package/dist/core/session/session-manager.js +299 -30
- package/dist/core/session/session-renew.js +19 -12
- package/dist/core/session/session-turn-coordinator.js +11 -4
- package/dist/eck/kit-renderer.js +18 -9
- package/dist/index.js +283 -65
- package/dist/ipc.js +374 -24
- package/dist/paths.js +64 -7
- package/dist/response-system/context-builder.js +1 -7
- package/dist/trigger/anomaly-store.js +1 -0
- package/dist/trigger/feedback.js +56 -5
- package/dist/trigger/history.js +79 -4
- package/dist/trigger/legacy-session-history.js +2 -2
- package/dist/trigger/parser.js +3 -2
- package/dist/trigger/validation.js +6 -1
- package/dist/utils/atomic-write.js +27 -0
- package/dist/utils/ecweb-utils.js +16 -2
- package/dist/utils/error-utils.js +4 -1
- package/dist/utils/logger.js +21 -2
- package/dist/utils/process-tree-stats.js +24 -4
- package/dist/utils/process-tree-worker.js +31 -0
- package/dist/utils/project-path.js +1 -2
- package/dist/utils/stats.js +52 -18
- package/dist/utils/welcome.js +2 -2
- package/kits/docs/INDEX.md +1 -1
- package/kits/docs/evolcore/INDEX.md +1 -1
- package/kits/docs/evolcore/contact.md +7 -1
- package/kits/docs/evolcore/msg.md +16 -0
- package/kits/rules/01-overview.md +1 -1
- package/kits/rules/03-identity.md +1 -1
- package/kits/rules/05-venue.md +1 -1
- package/kits/schemas/_meta.json +10 -5
- package/kits/schemas/agent-config.schema.10.json +2 -1
- package/kits/schemas/agent-config.schema.11.json +421 -0
- package/kits/schemas/daemon.schema.5.json +135 -0
- package/kits/schemas/daemon.schema.6.json +131 -0
- package/kits/schemas/defaults.schema.5.json +119 -0
- package/kits/schemas/migrations/README.md +3 -1
- package/kits/schemas/relation-config.schema.8.json +13 -0
- package/kits/schemas/role-config.schema.1.json +1 -2
- package/kits/schemas/single-session.schema.3.json +32 -0
- package/kits/templates/roles/admin.json +1 -0
- package/kits/templates/roles/member.json +1 -0
- package/kits/templates/roles/visitor.json +1 -0
- package/package.json +7 -3
- package/skills/eclink/SKILL.md +2 -0
|
@@ -65,7 +65,6 @@ export class ChannelLoader {
|
|
|
65
65
|
owner: agent.getOwner(aunEffName),
|
|
66
66
|
enabled: true,
|
|
67
67
|
keystorePath: agent.config.aun?.keystorePath,
|
|
68
|
-
gatewayUrl: agent.config.aun?.gatewayUrl,
|
|
69
68
|
};
|
|
70
69
|
const configInsts = [aunInst];
|
|
71
70
|
for (const inst of agent.config.channels) {
|
|
@@ -255,7 +254,6 @@ export function buildReloadHooks(deps) {
|
|
|
255
254
|
aid,
|
|
256
255
|
enabled: true,
|
|
257
256
|
keystorePath: agent.config?.aun?.keystorePath,
|
|
258
|
-
gatewayUrl: agent.config?.aun?.gatewayUrl,
|
|
259
257
|
}
|
|
260
258
|
: (() => {
|
|
261
259
|
const agentChannels = agent.config?.channels ?? [];
|
|
@@ -8,6 +8,7 @@ import { agentProjectRootFromDefaults, deriveAgentProjectPath } from '../../util
|
|
|
8
8
|
import { uploadAvatar } from '../../utils/avatar-upload.js';
|
|
9
9
|
import { agentmdGet, agentmdPut, updateAgentMdFrontmatterName } from '../../aun/aid/agentmd.js';
|
|
10
10
|
import { isValidAid } from '../../aun/aid/validation.js';
|
|
11
|
+
import { isSupportedBaseagent } from '../../agents/baseagent.js';
|
|
11
12
|
const SUPPORTED_AGENT_PATCH_FIELDS = new Set(['aid', 'name', 'avatar', 'active_baseagent', 'baseagents', 'projects', 'owners', 'chatmode', 'channels', 'channelOwners']);
|
|
12
13
|
const HIDDEN_VALUE = '[hidden]';
|
|
13
14
|
const SENSITIVE_CONFIG_KEYS = new Set([
|
|
@@ -95,6 +96,9 @@ function normalizeBaseagentsPatch(value) {
|
|
|
95
96
|
}
|
|
96
97
|
const out = {};
|
|
97
98
|
for (const [name, raw] of Object.entries(value)) {
|
|
99
|
+
if (!isSupportedBaseagent(name)) {
|
|
100
|
+
return { ok: false, error: `不支持的 baseagent: ${name}(可选: claude/codex/gemini/ecagent)` };
|
|
101
|
+
}
|
|
98
102
|
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
99
103
|
return { ok: false, error: `baseagents.${name} 必须是对象` };
|
|
100
104
|
}
|
|
@@ -286,11 +290,11 @@ function buildCreateProgressOnlyAgent(aid, progress) {
|
|
|
286
290
|
* 失败仅写日志 + create-status,不回传(受理即返回)。
|
|
287
291
|
* agentSet key 对照 cli/agent.ts 的 setNestedValue:
|
|
288
292
|
* model/effort → 'baseagents.<baseagent>.*';chatmode → 'chatmode'(ChatmodeBlock 对象)。 */
|
|
289
|
-
async function runCreateInBackground(opts, w) {
|
|
293
|
+
async function runCreateInBackground(opts, w, service) {
|
|
290
294
|
let curPhase = 'validating'; // 跟踪当前环节,供 catch 兜底时标注正确 phase
|
|
291
295
|
try {
|
|
292
296
|
// onPhase 把 agentCreateNonInteractive 内部环节(0-3、5)映射到进度文件
|
|
293
|
-
const
|
|
297
|
+
const createOptions = {
|
|
294
298
|
aid: opts.aid, name: opts.name, baseagent: opts.baseagent,
|
|
295
299
|
project: opts.project, owner: opts.owner,
|
|
296
300
|
onPhase: (phase, state, detail) => {
|
|
@@ -305,7 +309,10 @@ async function runCreateInBackground(opts, w) {
|
|
|
305
309
|
else if (state === 'failed')
|
|
306
310
|
w.finishFailed(phase, detail ?? 'failed');
|
|
307
311
|
},
|
|
308
|
-
}
|
|
312
|
+
};
|
|
313
|
+
const res = service
|
|
314
|
+
? await service.create(createOptions)
|
|
315
|
+
: await agentCreateNonInteractive(createOptions);
|
|
309
316
|
if (!('ok' in res) || res.ok !== true) {
|
|
310
317
|
// 硬失败:onPhase('failed') 已写终态;这里仅兜底日志(防回调未覆盖的 return 路径)
|
|
311
318
|
const err = res.error;
|
|
@@ -318,17 +325,23 @@ async function runCreateInBackground(opts, w) {
|
|
|
318
325
|
w.begin('applying_config');
|
|
319
326
|
let warned;
|
|
320
327
|
if (opts.model) {
|
|
321
|
-
const r =
|
|
328
|
+
const r = service
|
|
329
|
+
? await service.setConfig(opts.aid, `baseagents.${opts.baseagent}.model`, opts.model)
|
|
330
|
+
: await agentSet(opts.aid, `baseagents.${opts.baseagent}.model`, opts.model);
|
|
322
331
|
if (!('ok' in r) || !r.ok)
|
|
323
332
|
warned = `model: ${r.error}`;
|
|
324
333
|
}
|
|
325
334
|
if (opts.effort) {
|
|
326
|
-
const r =
|
|
335
|
+
const r = service
|
|
336
|
+
? await service.setConfig(opts.aid, `baseagents.${opts.baseagent}.effort`, opts.effort)
|
|
337
|
+
: await agentSet(opts.aid, `baseagents.${opts.baseagent}.effort`, opts.effort);
|
|
327
338
|
if (!('ok' in r) || !r.ok)
|
|
328
339
|
warned = `${warned ? warned + '; ' : ''}effort: ${r.error}`;
|
|
329
340
|
}
|
|
330
341
|
if (opts.chatmode) {
|
|
331
|
-
const r =
|
|
342
|
+
const r = service
|
|
343
|
+
? await service.setConfig(opts.aid, 'chatmode', JSON.stringify(opts.chatmode))
|
|
344
|
+
: await agentSet(opts.aid, 'chatmode', JSON.stringify(opts.chatmode));
|
|
332
345
|
if (!('ok' in r) || !r.ok)
|
|
333
346
|
warned = `${warned ? warned + '; ' : ''}chatmode: ${r.error}`;
|
|
334
347
|
}
|
|
@@ -361,7 +374,7 @@ async function runCreateInBackground(opts, w) {
|
|
|
361
374
|
/** name=agent 的 menu.action 执行。create 使用显式 owner AID;peerId 仅作为控制面鉴权主体。
|
|
362
375
|
* create 受理即返回(D3);delete/enable/disable 同步等结果。
|
|
363
376
|
* 调用方负责传入已兜底的 args.project(见 command-handler 装配)。 */
|
|
364
|
-
export async function execAgentAction(action, args, peerId, eventBus) {
|
|
377
|
+
export async function execAgentAction(action, args, peerId, eventBus, service) {
|
|
365
378
|
const a = args ?? {};
|
|
366
379
|
if (action === 'create') {
|
|
367
380
|
if (!peerId)
|
|
@@ -394,13 +407,15 @@ export async function execAgentAction(action, args, peerId, eventBus) {
|
|
|
394
407
|
project: a.project, owner,
|
|
395
408
|
model, effort, chatmode: a.chatmode,
|
|
396
409
|
eventBus,
|
|
397
|
-
}, progressWriter).catch(e => logger.error(`[agent-control] runCreateInBackground unhandled ${a.aid}: ${e?.message || e}`));
|
|
410
|
+
}, progressWriter, service).catch(e => logger.error(`[agent-control] runCreateInBackground unhandled ${a.aid}: ${e?.message || e}`));
|
|
398
411
|
return { data: { accepted: true, aid: a.aid } };
|
|
399
412
|
}
|
|
400
413
|
if (action === 'delete') {
|
|
401
414
|
if (!a.aid)
|
|
402
415
|
return { error: '缺少 aid', code: 'INVALID_ARGS' };
|
|
403
|
-
const res =
|
|
416
|
+
const res = service
|
|
417
|
+
? await service.delete(a.aid, false)
|
|
418
|
+
: await agentDelete(a.aid, false);
|
|
404
419
|
if (!('ok' in res) || res.ok !== true)
|
|
405
420
|
return { error: res.error, code: classifyError(res.error) };
|
|
406
421
|
eventBus?.publish({ type: 'agent:deleted', aid: res.aid, purged: res.purged, timestamp: Date.now() });
|
|
@@ -410,7 +425,13 @@ export async function execAgentAction(action, args, peerId, eventBus) {
|
|
|
410
425
|
if (!a.aid)
|
|
411
426
|
return { error: '缺少 aid', code: 'INVALID_ARGS' };
|
|
412
427
|
const options = { force: a.force === true };
|
|
413
|
-
const res =
|
|
428
|
+
const res = service
|
|
429
|
+
? action === 'enable'
|
|
430
|
+
? await service.enable(a.aid, options.force === true)
|
|
431
|
+
: await service.disable(a.aid, options.force === true)
|
|
432
|
+
: action === 'enable'
|
|
433
|
+
? await agentEnable(a.aid, options)
|
|
434
|
+
: await agentDisable(a.aid, options);
|
|
414
435
|
if (!('ok' in res) || res.ok !== true)
|
|
415
436
|
return { error: res.error, code: res.code || classifyError(res.error) };
|
|
416
437
|
eventBus?.publish({
|
|
@@ -424,7 +445,9 @@ export async function execAgentAction(action, args, peerId, eventBus) {
|
|
|
424
445
|
if (action === 'reload') {
|
|
425
446
|
if (!a.aid)
|
|
426
447
|
return { error: '缺少 aid', code: 'INVALID_ARGS' };
|
|
427
|
-
const res =
|
|
448
|
+
const res = service
|
|
449
|
+
? await service.reload(a.aid, { force: a.force === true })
|
|
450
|
+
: await agentReload(a.aid, { force: a.force === true });
|
|
428
451
|
if (!('ok' in res) || res.ok !== true)
|
|
429
452
|
return { error: res.error, code: res.code || classifyError(res.error) };
|
|
430
453
|
eventBus?.publish({ type: 'agent:reloaded', aid: a.aid, timestamp: Date.now() });
|
|
@@ -508,6 +531,9 @@ export async function execAgentUpdate(args) {
|
|
|
508
531
|
if (typeof p.active_baseagent !== 'string' || !p.active_baseagent.trim()) {
|
|
509
532
|
return { error: `无效 active_baseagent: ${JSON.stringify(p.active_baseagent)}(必须是非空字符串)`, code: 'INVALID_ARGS' };
|
|
510
533
|
}
|
|
534
|
+
if (!isSupportedBaseagent(p.active_baseagent.trim())) {
|
|
535
|
+
return { error: `不支持的 active_baseagent: ${p.active_baseagent}(可选: claude/codex/gemini/ecagent)`, code: 'INVALID_ARGS' };
|
|
536
|
+
}
|
|
511
537
|
config.active_baseagent = p.active_baseagent.trim();
|
|
512
538
|
touched = true;
|
|
513
539
|
}
|
|
@@ -576,7 +602,7 @@ export async function execAgentUpdate(args) {
|
|
|
576
602
|
/**
|
|
577
603
|
* project 解析与 ec agent create 保持一致:
|
|
578
604
|
* 显式值 > 默认项目根目录 + AID 前缀。
|
|
579
|
-
* 默认项目根目录由 defaults.projects.
|
|
605
|
+
* 默认项目根目录由 defaults.projects.defaultPath 或运行时根目录推导。
|
|
580
606
|
*/
|
|
581
607
|
export function resolveProjectPath(explicit, aid, defaults) {
|
|
582
608
|
if (explicit && explicit.trim())
|
|
@@ -585,13 +611,15 @@ export function resolveProjectPath(explicit, aid, defaults) {
|
|
|
585
611
|
return deriveAgentProjectPath(root, aid);
|
|
586
612
|
}
|
|
587
613
|
/** name=agent 的 menu.query:查单个 agent 详情,附构建进度(D3)。 */
|
|
588
|
-
export async function execAgentQuery(args) {
|
|
614
|
+
export async function execAgentQuery(args, service) {
|
|
589
615
|
const aid = args?.aid;
|
|
590
616
|
if (!aid)
|
|
591
617
|
return { error: '缺少 aid', code: 'INVALID_ARGS' };
|
|
592
618
|
const agentDir = path.join(resolvePaths().agentsDir, aid);
|
|
593
619
|
const progress = readCreateStatus(agentDir);
|
|
594
|
-
const res =
|
|
620
|
+
const res = service
|
|
621
|
+
? await service.show(aid)
|
|
622
|
+
: await agentShow(aid);
|
|
595
623
|
if (!('ok' in res) || res.ok !== true) {
|
|
596
624
|
const code = classifyError(res.error);
|
|
597
625
|
if (code === 'NOT_FOUND' && progress)
|
|
@@ -616,9 +644,21 @@ export async function execAgentQuery(args) {
|
|
|
616
644
|
return { data: progress ? { ...data, createProgress: progress } : data };
|
|
617
645
|
}
|
|
618
646
|
/** name=agent 的 menu.options:列出 agent(enabled 默认 / all) */
|
|
619
|
-
export async function execAgentOptions(args) {
|
|
647
|
+
export async function execAgentOptions(args, service) {
|
|
620
648
|
const scope = args?.options === 'all' ? 'all' : 'enabled';
|
|
621
|
-
const res =
|
|
649
|
+
const res = service
|
|
650
|
+
? { ok: true, agents: service.list().map(info => ({
|
|
651
|
+
aid: info.aid || info.name,
|
|
652
|
+
name: info.name,
|
|
653
|
+
personalName: info.personalName || null,
|
|
654
|
+
status: info.status || 'stopped',
|
|
655
|
+
channels: info.channels || [],
|
|
656
|
+
projectPath: info.projectPath ? toPosix(info.projectPath) : null,
|
|
657
|
+
baseagent: info.baseagent || null,
|
|
658
|
+
model: info.model || null,
|
|
659
|
+
lastActivity: info.lastActivity || null,
|
|
660
|
+
})) }
|
|
661
|
+
: await agentList();
|
|
622
662
|
if (!('ok' in res) || res.ok !== true)
|
|
623
663
|
return { error: res.error, code: classifyError(res.error) };
|
|
624
664
|
const agents = scope === 'all'
|