evolcore 0.0.43-test.3 → 0.0.43-test.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 +36 -0
- package/bin/ecmsg.js +229 -0
- package/bin/install-codex-managed-hooks.mjs +130 -8
- package/dist/ability/application-service.js +37 -0
- package/dist/ability/resources.js +28 -0
- package/dist/ability/runtime.js +6 -1
- package/dist/agents/claude-runner.js +7 -5
- package/dist/agents/codex/app-server-client.js +0 -12
- package/dist/agents/codex-runner.js +0 -37
- package/dist/agents/ecagent-runner.js +130 -35
- package/dist/aun/aid/agentmd.js +31 -12
- package/dist/aun/menu/client.js +8 -7
- package/dist/aun/menu/index.js +1 -1
- package/dist/aun/menu/transport.js +8 -5
- package/dist/aun/service-proxy.js +3 -0
- package/dist/channels/aun.js +26 -5
- package/dist/channels/daemon.js +10 -2
- package/dist/cli/agent-command.js +5 -0
- package/dist/cli/agent-create.js +28 -6
- package/dist/cli/agent.js +9 -3
- package/dist/cli/aun-commands.js +2 -2
- package/dist/cli/daemon-commands.js +30 -18
- package/dist/cli/directory.js +4 -7
- package/dist/cli/getmeta-command.js +2 -1
- package/dist/cli/init.js +13 -5
- package/dist/cli/trigger-command.js +20 -14
- package/dist/config/boot-log.js +12 -2
- package/dist/config/config-field-policy.js +2 -0
- package/dist/config/config-manager.js +9 -4
- package/dist/config/peer-role-resolver.js +1 -1
- package/dist/config/role-schema.js +3 -3
- package/dist/config/schema-migration.js +121 -0
- package/dist/core/agent-application-service.js +11 -0
- package/dist/core/agent-ipc-registration.js +2 -0
- package/dist/core/agent-runtime.js +41 -9
- package/dist/core/auth/auth-gateway.js +3 -3
- package/dist/core/auth/operation-authorizer.js +2 -1
- package/dist/core/baseagent-loader.js +11 -3
- package/dist/core/bootstrap-service.js +8 -0
- package/dist/core/channel-loader.js +61 -23
- package/dist/core/command/agent-control.js +4 -1
- package/dist/core/command/chatmode-config.js +46 -0
- package/dist/core/command/command-handler.js +5 -14
- package/dist/core/command/daemon-diagnostics.js +2 -1
- package/dist/core/command/menu-catalog.js +1 -1
- package/dist/core/command/menu-handler.js +16 -16
- package/dist/core/command/slash-handler.js +4 -26
- package/dist/core/daemon-lifecycle.js +35 -17
- package/dist/core/event-catalog.js +19 -0
- package/dist/core/evolagent-registry.js +3 -0
- package/dist/core/ipc-registration.js +6 -0
- package/dist/core/message/im-renderer.js +24 -19
- package/dist/core/message/message-admission.js +11 -2
- package/dist/core/message/response-engine.js +17 -18
- package/dist/core/model/model-capabilities.js +37 -0
- package/dist/core/model/model-catalog.js +6 -2
- package/dist/core/ownership/owner-resolver.js +6 -6
- package/dist/core/permission/ec-command-parser.js +47 -12
- package/dist/core/plugin-lifecycle.js +6 -2
- package/dist/core/relation/pa-team.js +7 -2
- package/dist/directory/owner-directory-cache.js +4 -2
- package/dist/directory/owner-directory-query-operation.js +5 -7
- package/dist/ecweb/runtime/lifecycle.js +29 -5
- package/dist/ecweb/runtime/supervisor.js +83 -27
- package/dist/index.js +198 -38
- package/dist/proxy/service-supervisor.js +377 -141
- package/dist/trigger/audit.js +3 -2
- package/dist/trigger/authorization.js +2 -3
- package/dist/trigger/history.js +4 -3
- package/dist/trigger/ipc-service.js +24 -19
- package/dist/trigger/manager.js +3 -5
- package/dist/trigger/parser.js +4 -21
- package/dist/trigger/patch.js +3 -15
- package/dist/trigger/scheduler.js +45 -10
- package/dist/trigger/validation.js +0 -13
- package/dist/utils/error-utils.js +8 -0
- package/dist/utils/macos-autostart.js +31 -0
- package/dist/utils/model-prices.jsonl +15 -8
- package/dist/utils/process-introspect.js +21 -1
- package/dist/utils/startup-trace.js +7 -1
- package/dist/utils/windows-autostart.js +1 -0
- package/ecagent/dist/harness/compaction/branch-summarization.js +1 -1
- package/ecagent/dist/harness/compaction/compaction.js +4 -4
- package/kits/docs/evolcore/INDEX.md +1 -1
- package/kits/docs/evolcore/file-navigation.md +63 -49
- package/kits/docs/evolcore/menu-protocol.md +1 -0
- package/kits/docs/evolcore/model.md +5 -3
- package/kits/docs/evolcore/response.md +2 -0
- package/kits/docs/evolcore/thread-chain.md +1 -1
- package/kits/docs/evolcore/tool-authorization.md +4 -1
- package/kits/docs/evolcore/trigger.md +10 -7
- package/kits/eck_manifest.json +0 -21
- package/kits/rules/01-overview.md +42 -44
- package/kits/rules/02-navigation.md +44 -53
- package/kits/rules/03-identity.md +21 -25
- package/kits/rules/04-relation.md +23 -33
- package/kits/rules/05-venue.md +24 -25
- package/kits/schemas/_meta.json +13 -26
- package/kits/schemas/agent-config.schema.19.json +10 -6
- package/kits/schemas/relation-config.schema.12.json +2 -2
- package/kits/schemas/role-config.schema.2.json +5 -5
- package/kits/skills/ec-service-proxy/SKILL.md +10 -0
- package/kits/skills/ec-trigger/SKILL.md +1 -1
- package/kits/templates/system-fragments/commands.md +1 -1
- package/kits/templates/system-fragments/identity.md +0 -1
- package/package.json +18 -13
- package/kits/schemas/agent-config.schema.20.json +0 -925
- package/kits/schemas/relation-config.schema.13.json +0 -289
- package/kits/schemas/role-config.schema.3.json +0 -1038
package/dist/channels/aun.js
CHANGED
|
@@ -6752,7 +6752,6 @@ export class AUNChannel {
|
|
|
6752
6752
|
if (delivery.chatType === 'group') {
|
|
6753
6753
|
logger.info(`${this.logPrefix()} thought.put ok group=${targetId} task=${taskId} stage=${stage} encrypt=${encrypt} tid=${tid ?? '?'}`);
|
|
6754
6754
|
this.eventBus?.publish?.({ type: 'message:thought-put', agentName: this.config.aid, channelId, taskId, text: thoughtText });
|
|
6755
|
-
this.forwardOutbound(putRes);
|
|
6756
6755
|
if (thoughtText) {
|
|
6757
6756
|
const statsContext = await this.groupStatsContext(channelId);
|
|
6758
6757
|
this.aidStatsCollector?.recordOutbound(this.config.aid, channelId, Buffer.byteLength(thoughtText, 'utf-8'), thoughtText, false, encrypt, context?.metadata?.chatmode ?? 'proactive', 'thought', statsContext);
|
|
@@ -6761,7 +6760,6 @@ export class AUNChannel {
|
|
|
6761
6760
|
else {
|
|
6762
6761
|
logger.info(`${this.logPrefix()} thought.put ok p2p=${this.peerLabel(targetId)} task=${taskId} stage=${stage} encrypt=${encrypt} tid=${tid ?? '?'}`);
|
|
6763
6762
|
this.eventBus?.publish?.({ type: 'message:thought-put', agentName: this.config.aid, channelId, taskId, text: thoughtText });
|
|
6764
|
-
this.forwardOutbound(putRes);
|
|
6765
6763
|
if (thoughtText) {
|
|
6766
6764
|
this.aidStatsCollector?.recordOutbound(this.config.aid, targetId, Buffer.byteLength(thoughtText, 'utf-8'), thoughtText, false, encrypt, context?.metadata?.chatmode ?? 'proactive', 'thought');
|
|
6767
6765
|
}
|
|
@@ -7479,7 +7477,13 @@ export class AUNChannel {
|
|
|
7479
7477
|
}
|
|
7480
7478
|
await this.sendStructuredOrThrow(channelId, payloadObj, context);
|
|
7481
7479
|
}
|
|
7482
|
-
|
|
7480
|
+
/**
|
|
7481
|
+
* `clientCloseBudgetMs` 只给退出路径用:SDK 的 `close()` 要等 WebSocket 关闭握手
|
|
7482
|
+
* (`transport.js` 里 `ws.on('close')` 后面挂了 3s 兜底),正常也要 2.4s 才返回。
|
|
7483
|
+
* daemon 马上 `exit(0)`,握手等不完的 socket 会随进程消失,为此等满没有意义——
|
|
7484
|
+
* 传入预算时到点就往下走,不再等 SDK。
|
|
7485
|
+
*/
|
|
7486
|
+
async disconnect(clientCloseBudgetMs) {
|
|
7483
7487
|
this.stopOwnerDirectoryRefresh();
|
|
7484
7488
|
this.configuredOwnerBindEpoch++;
|
|
7485
7489
|
if (this.client) {
|
|
@@ -7494,8 +7498,25 @@ export class AUNChannel {
|
|
|
7494
7498
|
}
|
|
7495
7499
|
if (this.client) {
|
|
7496
7500
|
this.trace('OUT', 'client.close', { reason: 'disconnect' });
|
|
7501
|
+
// 未等到 close 的 promise 可能稍后 reject(握手被进程退出截断),全程吞掉以免 unhandledRejection。
|
|
7502
|
+
const closing = this.client.close().catch(() => { });
|
|
7497
7503
|
try {
|
|
7498
|
-
|
|
7504
|
+
if (clientCloseBudgetMs === undefined) {
|
|
7505
|
+
await closing;
|
|
7506
|
+
}
|
|
7507
|
+
else {
|
|
7508
|
+
let timer;
|
|
7509
|
+
try {
|
|
7510
|
+
await Promise.race([
|
|
7511
|
+
closing,
|
|
7512
|
+
new Promise(resolve => { timer = setTimeout(resolve, clientCloseBudgetMs); }),
|
|
7513
|
+
]);
|
|
7514
|
+
}
|
|
7515
|
+
finally {
|
|
7516
|
+
if (timer)
|
|
7517
|
+
clearTimeout(timer);
|
|
7518
|
+
}
|
|
7519
|
+
}
|
|
7499
7520
|
this.trace('OUT', 'client.close.ok', { reason: 'disconnect' });
|
|
7500
7521
|
}
|
|
7501
7522
|
catch (e) {
|
|
@@ -8217,7 +8238,7 @@ export class AUNChannelPlugin {
|
|
|
8217
8238
|
policy,
|
|
8218
8239
|
options: { flushDelay: inst.flushDelay ?? DEFAULT_FLUSH_DELAY_SECONDS, fileMarkerPattern: createSendFileMarkerPattern() },
|
|
8219
8240
|
connect: () => channel.connect(),
|
|
8220
|
-
disconnect: () => channel.disconnect(),
|
|
8241
|
+
disconnect: (clientCloseBudgetMs) => channel.disconnect(clientCloseBudgetMs),
|
|
8221
8242
|
onProjectPathRequest: () => Promise.resolve(ctx.defaultProjectPath),
|
|
8222
8243
|
registerBridge(bridge, channelType) {
|
|
8223
8244
|
bridge.register(adapter.channelName, (handler) => channel.onMessage(async (opts) => {
|
package/dist/channels/daemon.js
CHANGED
|
@@ -292,7 +292,7 @@ export class DaemonChannel {
|
|
|
292
292
|
// 反馈目标与触发方式(consolidation.ts 在 normalize 后补挂的字段):
|
|
293
293
|
// 收尾时据此投递反馈,并判断是否该反馈(定时触发不反馈)。
|
|
294
294
|
const { feedbackOrigin, consolidationTriggeredBy } = trigger.execution;
|
|
295
|
-
|
|
295
|
+
const metadata = {
|
|
296
296
|
channelKey: this.channelKey,
|
|
297
297
|
peerId: `trigger:${trigger.id}`,
|
|
298
298
|
peerName: trigger.name,
|
|
@@ -303,7 +303,15 @@ export class DaemonChannel {
|
|
|
303
303
|
...(consolidationMemoryDir ? { consolidationMemoryDir } : {}),
|
|
304
304
|
...(feedbackOrigin ? { feedbackOrigin } : {}),
|
|
305
305
|
...(consolidationTriggeredBy ? { consolidationTriggeredBy } : {}),
|
|
306
|
-
}
|
|
306
|
+
};
|
|
307
|
+
const session = await this.sessionManager.getOrCreateSession(this.channelName, channelId, projectPath, threadId, metadata, trigger.name, undefined, 'private', baseagent, trigger.agentAid, this.channelName, 'system');
|
|
308
|
+
if (session.baseagent === baseagent)
|
|
309
|
+
return session;
|
|
310
|
+
const inheritedSession = await this.sessionManager.getOrCreateSession(this.channelName, channelId, projectPath, `${threadId}:baseagent:${baseagent}`, metadata, trigger.name, undefined, 'private', baseagent, trigger.agentAid, this.channelName, 'system');
|
|
311
|
+
if (inheritedSession.baseagent !== baseagent) {
|
|
312
|
+
throw new Error(`Trigger session baseagent mismatch: expected ${baseagent}, got ${inheritedSession.baseagent}`);
|
|
313
|
+
}
|
|
314
|
+
return inheritedSession;
|
|
307
315
|
}
|
|
308
316
|
executionDeadlineAt(startedAt = Date.now()) {
|
|
309
317
|
return this.totalExecutionMs === undefined
|
|
@@ -82,6 +82,7 @@ function printAgentNewHelp() {
|
|
|
82
82
|
--project <path> 默认: 当前目录
|
|
83
83
|
--baseagent <claude|codex|gemini|ecagent>
|
|
84
84
|
默认: defaults 配置,否则检测本机可用基座
|
|
85
|
+
--provider <id> 指定该 Base Agent 使用的 Provider
|
|
85
86
|
--model <id> 初始化可选;须在主机当前基座的可见模型目录中
|
|
86
87
|
--effort <level> 初始化可选;需同时指定 model,auto 使用默认强度
|
|
87
88
|
--owner <aid> 必填;初始协议 Owner 绑定意图
|
|
@@ -381,6 +382,7 @@ Options:
|
|
|
381
382
|
aid: name,
|
|
382
383
|
project: getArg('--project'),
|
|
383
384
|
baseagent: getArg('--baseagent'),
|
|
385
|
+
provider: getArg('--provider'),
|
|
384
386
|
...ownerOptions,
|
|
385
387
|
...avatarOptions,
|
|
386
388
|
name: getArg('--name'),
|
|
@@ -411,6 +413,8 @@ Options:
|
|
|
411
413
|
console.log(` AID: ${plan.aid}`);
|
|
412
414
|
console.log(` Project: ${plan.project}`);
|
|
413
415
|
console.log(` Baseagent: ${plan.baseagent} (${plan.baseagentSource})`);
|
|
416
|
+
if (plan.provider)
|
|
417
|
+
console.log(` Provider: ${plan.provider}`);
|
|
414
418
|
console.log(` Owner: ${plan.owner || '未设置'} (${plan.ownerSource})`);
|
|
415
419
|
console.log(` Name: ${plan.name} (${plan.nameSource})`);
|
|
416
420
|
if (plan.description)
|
|
@@ -422,6 +426,7 @@ Options:
|
|
|
422
426
|
const result = await agentCreateNonInteractive({
|
|
423
427
|
aid: plan.aid,
|
|
424
428
|
baseagent: plan.baseagent,
|
|
429
|
+
provider: plan.provider,
|
|
425
430
|
project: plan.project,
|
|
426
431
|
owner: plan.owner,
|
|
427
432
|
name: plan.name,
|
package/dist/cli/agent-create.js
CHANGED
|
@@ -178,7 +178,7 @@ export function resolveAgentCreatePlan(options, projectCwd = process.cwd()) {
|
|
|
178
178
|
const type = requestedType ? (normalizeAgentType(requestedType) ?? requestedType) : DEFAULT_AGENT_TYPE;
|
|
179
179
|
const configExists = isValidAid(aid) && fs.existsSync(path.join(resolvePaths().agentsDir, aid, 'config.json'));
|
|
180
180
|
return {
|
|
181
|
-
aid, project, baseagent, owner, avatarFile: options.avatarFile, avatarUrl: options.avatarUrl,
|
|
181
|
+
aid, project, baseagent, provider: options.provider?.trim() || undefined, owner, avatarFile: options.avatarFile, avatarUrl: options.avatarUrl,
|
|
182
182
|
name, description, type, tags: options.tags,
|
|
183
183
|
force: options.force === true, configExists, baseagentSource, ownerSource,
|
|
184
184
|
nameSource: options.name?.trim() ? 'argument' : metadata.name ? 'package' : 'directory',
|
|
@@ -228,12 +228,22 @@ export function validateAgentCreatePlan(plan) {
|
|
|
228
228
|
if (!detectAvailableBaseagents().includes(plan.baseagent)) {
|
|
229
229
|
return `${plan.baseagent} is not available in the current environment`;
|
|
230
230
|
}
|
|
231
|
+
if (plan.provider !== undefined) {
|
|
232
|
+
if (!plan.provider.trim())
|
|
233
|
+
return 'Provider must be a non-empty string';
|
|
234
|
+
try {
|
|
235
|
+
resolveProviderServiceForBaseagent(plan.provider.trim(), plan.baseagent);
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
return error instanceof Error ? error.message : String(error);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
231
241
|
return null;
|
|
232
242
|
}
|
|
233
|
-
function saveInitialBehavior(aid, baseagent) {
|
|
243
|
+
function saveInitialBehavior(aid, baseagent, provider) {
|
|
234
244
|
const behavior = {
|
|
235
245
|
active_baseagent: baseagent,
|
|
236
|
-
baseagents: { [baseagent]: {} },
|
|
246
|
+
baseagents: { [baseagent]: provider ? { provider } : {} },
|
|
237
247
|
chatmode: { private: 'interactive', group: 'proactive', nothuman: 'proactive' },
|
|
238
248
|
};
|
|
239
249
|
const sel = { self: aid };
|
|
@@ -550,6 +560,17 @@ export async function agentCreateNonInteractive(opts, runtime = {}) {
|
|
|
550
560
|
return failValidating('ecagent is optional; pass --baseagent ecagent to select it explicitly');
|
|
551
561
|
baseagent = defaultBaseagent;
|
|
552
562
|
}
|
|
563
|
+
const provider = opts.provider?.trim();
|
|
564
|
+
if (opts.provider !== undefined && !provider)
|
|
565
|
+
return failValidating('Provider must be a non-empty string');
|
|
566
|
+
if (provider) {
|
|
567
|
+
try {
|
|
568
|
+
resolveProviderServiceForBaseagent(provider, baseagent);
|
|
569
|
+
}
|
|
570
|
+
catch (error) {
|
|
571
|
+
return failValidating(error instanceof Error ? error.message : String(error));
|
|
572
|
+
}
|
|
573
|
+
}
|
|
553
574
|
if (!path.isAbsolute(opts.project))
|
|
554
575
|
return failValidating(`--project must be absolute: ${opts.project}`);
|
|
555
576
|
if (!fs.existsSync(opts.project)) {
|
|
@@ -609,7 +630,7 @@ export async function agentCreateNonInteractive(opts, runtime = {}) {
|
|
|
609
630
|
opts.onPhase?.('config_saved', 'begin');
|
|
610
631
|
saveAgent({ $schema_version: CONFIG_SCHEMA_VERSION, aid: opts.aid, enabled: true, lifecycle: preservedLifecycle, channels: [], projects: { defaultPath: opts.project } });
|
|
611
632
|
ensureInitialRoleRegistry(opts.aid);
|
|
612
|
-
saveInitialBehavior(opts.aid, baseagent);
|
|
633
|
+
saveInitialBehavior(opts.aid, baseagent, provider);
|
|
613
634
|
ensureAgentDirSkeleton(opts.aid);
|
|
614
635
|
opts.onPhase?.('config_saved', 'done');
|
|
615
636
|
opts.onPhase?.('uploading_agentmd', 'begin');
|
|
@@ -1986,7 +2007,7 @@ export function parseInitializationArgs(args) {
|
|
|
1986
2007
|
throw new Error('--bootstrap cannot initialize an agent');
|
|
1987
2008
|
const booleans = new Set(resume ? ['--resume'] : ['--initialize', '--non-interactive', '--dry-run']);
|
|
1988
2009
|
const strings = new Set(resume ? ['--wait', '--format', '--client-request-id'] : [
|
|
1989
|
-
'--project', '--baseagent', '--model', '--effort', '--owner', '--name', '--description', '--tags', '--type', '--avatar-file', '--avatar-url',
|
|
2010
|
+
'--project', '--baseagent', '--provider', '--model', '--effort', '--owner', '--name', '--description', '--tags', '--type', '--avatar-file', '--avatar-url',
|
|
1990
2011
|
'--persona-file', '--persona-text', '--wait', '--format',
|
|
1991
2012
|
]);
|
|
1992
2013
|
const seen = new Set();
|
|
@@ -2035,7 +2056,7 @@ export function resolveInitializationPlan(args, context) {
|
|
|
2035
2056
|
? readInitializationPersona(v['--persona-file'], !!context, context)
|
|
2036
2057
|
: v['--persona-text'];
|
|
2037
2058
|
const p = resolveAgentCreatePlan({
|
|
2038
|
-
aid: parsed.aid, project: v['--project'], baseagent: v['--baseagent'], ...parseAgentOwnerArgs(args),
|
|
2059
|
+
aid: parsed.aid, project: v['--project'], baseagent: v['--baseagent'], provider: v['--provider'], ...parseAgentOwnerArgs(args),
|
|
2039
2060
|
avatarFile: v['--avatar-file'], avatarUrl: v['--avatar-url'],
|
|
2040
2061
|
name: v['--name'], description: v['--description'], tags: parseAgentTags(v['--tags']), type: v['--type'],
|
|
2041
2062
|
}, context?.projectCwd);
|
|
@@ -2043,6 +2064,7 @@ export function resolveInitializationPlan(args, context) {
|
|
|
2043
2064
|
const effort = v['--effort']?.trim();
|
|
2044
2065
|
return {
|
|
2045
2066
|
aid: p.aid, project: p.project, baseagent: p.baseagent ?? '',
|
|
2067
|
+
...(v['--provider']?.trim() ? { provider: v['--provider'].trim() } : {}),
|
|
2046
2068
|
...(model ? { model } : {}),
|
|
2047
2069
|
...(effort && effort !== 'auto' ? { effort } : {}),
|
|
2048
2070
|
ownerAid: p.owner ?? '',
|
package/dist/cli/agent.js
CHANGED
|
@@ -60,13 +60,13 @@ function readAgentMdIdentity(aid) {
|
|
|
60
60
|
if (!fs.existsSync(file))
|
|
61
61
|
return { name: null, description: null };
|
|
62
62
|
const content = fs.readFileSync(file, 'utf8');
|
|
63
|
-
const frontmatter = content.match(/^---\n([\s\S]*?)\n---/);
|
|
63
|
+
const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
64
64
|
if (!frontmatter)
|
|
65
65
|
return { name: null, description: null };
|
|
66
66
|
const body = frontmatter[1];
|
|
67
67
|
return {
|
|
68
|
-
name: body.match(/^name
|
|
69
|
-
description: body.match(/^description
|
|
68
|
+
name: body.match(/^name:[ \t]*["']?(.+?)["']?[ \t]*$/m)?.[1]?.trim() || null,
|
|
69
|
+
description: body.match(/^description:[ \t]*["']?(.+?)["']?[ \t]*$/m)?.[1]?.trim() || null,
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
catch {
|
|
@@ -107,6 +107,12 @@ export async function agentList(registry) {
|
|
|
107
107
|
const result = await ipcQuery(p.socket, { type: 'evolagent.list' });
|
|
108
108
|
if (result && result.ok && result.agents) {
|
|
109
109
|
const agents = result.agents.map((info) => toAgentListItem(info));
|
|
110
|
+
// 显示名以本地 agent.md 为准:daemon 侧是进程内缓存,改名后未必已刷新。
|
|
111
|
+
for (const agent of agents) {
|
|
112
|
+
const identity = readAgentMdIdentity(agent.aid);
|
|
113
|
+
if (identity.name)
|
|
114
|
+
agent.name = identity.name;
|
|
115
|
+
}
|
|
110
116
|
return { ok: true, agents };
|
|
111
117
|
}
|
|
112
118
|
}
|
package/dist/cli/aun-commands.js
CHANGED
|
@@ -1501,8 +1501,8 @@ Options:
|
|
|
1501
1501
|
*
|
|
1502
1502
|
* 使用 `interval` 而非 `delay`:周期触发,由显式
|
|
1503
1503
|
* `ec trigger delete`(结束,不留残留)/ `ec trigger update --every <新时长>`(调整周期)改变状态。
|
|
1504
|
-
* `ec trigger
|
|
1505
|
-
* 不该走
|
|
1504
|
+
* `ec trigger disable` 只停用后续调度,定义仍留在磁盘上,复查这种用完即弃的 Trigger
|
|
1505
|
+
* 不该走 disable,否则会积压大量永不触发的死定义。
|
|
1506
1506
|
* 一次性 Trigger 会静默消失,无法承担「一直跟进直到显式结束」的语义。
|
|
1507
1507
|
*/
|
|
1508
1508
|
export function buildThreadCheckTrigger(input) {
|
|
@@ -626,7 +626,7 @@ function printStartupInfo(opts = {}, asMode) {
|
|
|
626
626
|
console.log(` Daemon执行: ${daemonExecution}`);
|
|
627
627
|
}
|
|
628
628
|
if (!opts.statusLayout)
|
|
629
|
-
console.log(`
|
|
629
|
+
console.log(` 代码最新修改: ${latestMtime ? formatLocalTime(latestMtime) : '?'}`);
|
|
630
630
|
}
|
|
631
631
|
export async function cmdStart(opts = {}) {
|
|
632
632
|
// Measure from process start so the reported time includes CLI bootstrap
|
|
@@ -941,6 +941,10 @@ export async function cmdStart(opts = {}) {
|
|
|
941
941
|
// ready signal 出现(优先检查,避免 Windows 上误判进程状态)
|
|
942
942
|
if (fs.existsSync(p.readySignal)) {
|
|
943
943
|
console.log(`✓ EvolCore started successfully (PID: ${childPid})`);
|
|
944
|
+
const daemonRecord = scanInstances().mains.find(entry => entry.alive && entry.record.pid === childPid)?.record;
|
|
945
|
+
if (daemonRecord?.startedAtIso) {
|
|
946
|
+
console.log(` Daemon 启动时间: ${new Date(daemonRecord.startedAtIso).toLocaleString()}`);
|
|
947
|
+
}
|
|
944
948
|
console.log(` EVOLCORE_HOME: ${resolveRoot()}`);
|
|
945
949
|
console.log(` Logs: ${p.logs}/`);
|
|
946
950
|
// ready 已到,先闭合 waitReady —— 后面的日志解析/代码统计是启动成功之后的开销,
|
|
@@ -1922,16 +1926,8 @@ export async function cmdLogs(args) {
|
|
|
1922
1926
|
const moduleIdx = args.indexOf('--module');
|
|
1923
1927
|
const level = levelIdx !== -1 ? args[levelIdx + 1] : undefined;
|
|
1924
1928
|
const module = moduleIdx !== -1 ? args[moduleIdx + 1] : undefined;
|
|
1929
|
+
let managedRawAuthorized = false;
|
|
1925
1930
|
if (process.env.EVOLCORE_SESSION_ID) {
|
|
1926
|
-
if (raw) {
|
|
1927
|
-
const reason = '--raw is unavailable in managed tasks; use it from the host terminal';
|
|
1928
|
-
console.error(`EVOLCORE_TOOL_ERROR_V1 ${JSON.stringify({
|
|
1929
|
-
errorCode: 'POLICY_DENIED', decisionSource: 'policy', policyCode: 'managed_logs_raw', reason,
|
|
1930
|
-
})}`);
|
|
1931
|
-
console.error(`❌ [NOT_ALLOWED] ${reason}`);
|
|
1932
|
-
process.exitCode = 1;
|
|
1933
|
-
return;
|
|
1934
|
-
}
|
|
1935
1931
|
try {
|
|
1936
1932
|
const statusArgs = ['logs', ...args];
|
|
1937
1933
|
const result = await ipcQuery(resolvePaths().socket, {
|
|
@@ -1952,13 +1948,27 @@ export async function cmdLogs(args) {
|
|
|
1952
1948
|
process.exitCode = 1;
|
|
1953
1949
|
return;
|
|
1954
1950
|
}
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1951
|
+
if (raw) {
|
|
1952
|
+
if (result.data?.rawAuthorized !== true) {
|
|
1953
|
+
const reason = 'Managed raw logs were not authorized';
|
|
1954
|
+
console.error(`EVOLCORE_TOOL_ERROR_V1 ${JSON.stringify({
|
|
1955
|
+
errorCode: 'POLICY_DENIED', decisionSource: 'policy', policyCode: 'managed_logs_raw', reason,
|
|
1956
|
+
})}`);
|
|
1957
|
+
console.error(`❌ [NOT_ALLOWED] ${reason}`);
|
|
1958
|
+
process.exitCode = 1;
|
|
1959
|
+
return;
|
|
1960
|
+
}
|
|
1961
|
+
managedRawAuthorized = true;
|
|
1962
|
+
}
|
|
1963
|
+
else {
|
|
1964
|
+
const rows = Array.isArray(result.data?.lines) ? result.data.lines : [];
|
|
1965
|
+
const managedOpts = { level, module, color: false };
|
|
1966
|
+
for (const row of rows) {
|
|
1967
|
+
const line = typeof row?.raw === 'string' ? row.raw : JSON.stringify(row);
|
|
1968
|
+
const rendered = renderLogLine(line, { color: managedOpts.color });
|
|
1969
|
+
if (rendered !== null)
|
|
1970
|
+
process.stdout.write(rendered + '\n');
|
|
1971
|
+
}
|
|
1962
1972
|
}
|
|
1963
1973
|
}
|
|
1964
1974
|
catch (error) {
|
|
@@ -1968,8 +1978,10 @@ export async function cmdLogs(args) {
|
|
|
1968
1978
|
})}`);
|
|
1969
1979
|
console.error(`❌ logs 查询失败:${reason}`);
|
|
1970
1980
|
process.exitCode = 1;
|
|
1981
|
+
return;
|
|
1971
1982
|
}
|
|
1972
|
-
|
|
1983
|
+
if (!raw || !managedRawAuthorized)
|
|
1984
|
+
return;
|
|
1973
1985
|
}
|
|
1974
1986
|
const p = resolvePaths();
|
|
1975
1987
|
const mainLog = findLatestLog(p.logs, 'daemon');
|
package/dist/cli/directory.js
CHANGED
|
@@ -3,8 +3,7 @@ import { daemonUnavailableMessage, getArgValue, isHelpFlag, queryDaemon, wantsHe
|
|
|
3
3
|
import { AGENT_DELEGATION_TOKEN_ENV, readDelegationCredential } from '../core/auth/agent-delegation.js';
|
|
4
4
|
import { DirectoryQueryError, executeDirectoryQueryCommand, resolveDirectoryQueryCommand, } from '../directory/owner-directory-query-operation.js';
|
|
5
5
|
import { executeDirectoryRequestCommand, resolveDirectoryRequestCommand, } from '../directory/owner-directory-request-operation.js';
|
|
6
|
-
|
|
7
|
-
const QUERY_ACTIONS = new Set(['list', 'info', 'refresh', 'blocked', 'find', 'show']);
|
|
6
|
+
const QUERY_ACTIONS = new Set(['list', 'info', 'refresh', 'blocked']);
|
|
8
7
|
/**
|
|
9
8
|
* `ec directory ...`
|
|
10
9
|
*
|
|
@@ -12,8 +11,7 @@ const QUERY_ACTIONS = new Set(['list', 'info', 'refresh', 'blocked', 'find', 'sh
|
|
|
12
11
|
* 直接读写自己目录下的 `<agent>/directory/remarks/<联系人AID>.md`,改完再
|
|
13
12
|
* `ec directory refresh` 让 `directory.md` 重算。
|
|
14
13
|
*
|
|
15
|
-
* 命令面与 `ec skill` 对齐:`list` 列举/过滤(含分页),`info`
|
|
16
|
-
* 旧的 `find` / `show` 保留为别名。
|
|
14
|
+
* 命令面与 `ec skill` 对齐:`list` 列举/过滤(含分页),`info` 看单条详情。
|
|
17
15
|
*/
|
|
18
16
|
export async function cmdDirectory(args) {
|
|
19
17
|
if (args.length === 0 || isHelpFlag(args[0]) || wantsHelp(args)) {
|
|
@@ -190,15 +188,14 @@ request:向目标发送 app-v1 friend.invite.v1 加好友申请;介绍默认
|
|
|
190
188
|
list:
|
|
191
189
|
列举名录;给关键词时按 AID、名字、备注、描述、exttype 做子串匹配(不区分大小写)。
|
|
192
190
|
--filter 与 ec skill list --filter 同语义:组内逗号分隔为 OR,多个 --filter 之间为 AND;
|
|
193
|
-
|
|
191
|
+
位置参数按“多个词同时命中”处理。
|
|
194
192
|
默认每页 20 条,--page / --limit 可翻页;输出包含 type、exttype、描述、备注、
|
|
195
193
|
Owner 绑定关系与 Ownership 核验状态。本地备注正文不在 list 展示。
|
|
196
|
-
旧名 find 等价于 list <关键词>。
|
|
197
194
|
|
|
198
195
|
info:
|
|
199
196
|
接受 AID 或名字。AID 大小写不敏感、可带 @ 前缀;名字先做归一后的精确匹配
|
|
200
197
|
(全角/半角、空格、结尾括号称呼不影响),没命中再按名字包含匹配,结果标
|
|
201
|
-
matchKind=fuzzy
|
|
198
|
+
matchKind=fuzzy。返回完整记录(含本地备注正文)。
|
|
202
199
|
|
|
203
200
|
refresh:
|
|
204
201
|
拉一次最新名录并重算 directory.md / identity.json。拉取需要 channel 在线;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import fs from 'fs';
|
|
3
|
+
import { loadAgent } from '../config-store.js';
|
|
3
4
|
import { resolvePaths, agentThreadIndexPath, agentTriggersDir } from '../paths.js';
|
|
4
5
|
import { scanChatDirs, readLastJsonlLine, } from '../core/session/session-fs-store.js';
|
|
5
6
|
import { isMainTopicId } from '../core/thread/topic-id.js';
|
|
@@ -147,7 +148,7 @@ async function cmdGetTriggerMeta(id, selfFilter, jsonFormat) {
|
|
|
147
148
|
agentAid: def.agentAid,
|
|
148
149
|
name: def.name,
|
|
149
150
|
enabled: def.enabled,
|
|
150
|
-
baseagent: def.execution.
|
|
151
|
+
baseagent: def.execution.type === 'trigger_session' ? loadAgent(def.agentAid)?.active_baseagent ?? null : null,
|
|
151
152
|
executionSessionId,
|
|
152
153
|
originChannelKey: def.origin?.channelKey ?? null,
|
|
153
154
|
originChannelId: def.origin?.channelId ?? null,
|
package/dist/cli/init.js
CHANGED
|
@@ -125,6 +125,10 @@ function isAutostartOnlyRequest(options) {
|
|
|
125
125
|
function applyExplicitAutostart(enabled, runtimeRoot) {
|
|
126
126
|
const result = configureAutostart(enabled, runtimeRoot);
|
|
127
127
|
if (!result.ok) {
|
|
128
|
+
if (result.nonFatal) {
|
|
129
|
+
console.log(`⚠ ${autostartPlatformLabel() || '登录自启'}未配置:${result.error || '检测到外部配置占用,未覆盖。'}`);
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
128
132
|
console.log(`❌ ${autostartPlatformLabel() || '登录自启'}配置失败: ${result.error || '未知错误'}`);
|
|
129
133
|
printWindowsAutostartRetryInstructions(enabled);
|
|
130
134
|
}
|
|
@@ -504,7 +508,6 @@ export async function initTail(options = {}) {
|
|
|
504
508
|
const daemonConfig = loadDaemonConfig();
|
|
505
509
|
let controlAidReady = !!daemonConfig.aid;
|
|
506
510
|
let autoStartReady = true;
|
|
507
|
-
const autoStartExplicit = options.autoStart !== undefined;
|
|
508
511
|
if (daemonConfig.aid) {
|
|
509
512
|
console.log(`✓ 控制 AID 已存在: ${daemonConfig.aid}`);
|
|
510
513
|
}
|
|
@@ -575,6 +578,10 @@ export async function initTail(options = {}) {
|
|
|
575
578
|
function applyAutostart(enabled) {
|
|
576
579
|
const result = configureAutostart(enabled, resolvePaths().root);
|
|
577
580
|
if (!result.ok) {
|
|
581
|
+
if (result.nonFatal) {
|
|
582
|
+
console.log(` ⚠ ${autostartPlatformLabel() || '登录自启'}未配置:${result.error || '检测到外部配置占用,未覆盖。'}`);
|
|
583
|
+
return true;
|
|
584
|
+
}
|
|
578
585
|
console.log(` ❌ ${autostartPlatformLabel() || '登录自启'}配置失败: ${result.error || '未知错误'}`);
|
|
579
586
|
printWindowsAutostartRetryInstructions(enabled);
|
|
580
587
|
return false;
|
|
@@ -643,8 +650,6 @@ export async function initTail(options = {}) {
|
|
|
643
650
|
return false;
|
|
644
651
|
}
|
|
645
652
|
if (!autoStartReady) {
|
|
646
|
-
if (autoStartExplicit)
|
|
647
|
-
return false;
|
|
648
653
|
console.log(' ⚠️ 登录自启配置未完成,可稍后运行 ec init --auto-start 重试');
|
|
649
654
|
}
|
|
650
655
|
// 初始化完成总结
|
|
@@ -861,14 +866,17 @@ export async function cmdInitNonInteractive(opts, dependencies = {}) {
|
|
|
861
866
|
if (opts.autoStart !== undefined) {
|
|
862
867
|
const autostart = configureAutostart(opts.autoStart, p.root);
|
|
863
868
|
if (!autostart.ok) {
|
|
864
|
-
|
|
869
|
+
if (!autostart.nonFatal) {
|
|
870
|
+
fail('AUTOSTART_CONFIG_FAILED', autostart.error || 'failed to configure login autostart', EXIT_RUNTIME, format);
|
|
871
|
+
}
|
|
872
|
+
autostartWarning = autostart.error || 'login autostart was not changed because an external configuration owns the same name';
|
|
865
873
|
}
|
|
866
874
|
if (opts.autoStart === true && autostart.backend) {
|
|
867
875
|
// Keep the selected Windows backend visible to automation callers as
|
|
868
876
|
// well as in data/autostart-state.json.
|
|
869
877
|
autostartBackend = autostart.backend;
|
|
870
878
|
}
|
|
871
|
-
autostartWarning = autostart.warning;
|
|
879
|
+
autostartWarning = autostart.warning || (autostart.nonFatal ? autostart.error : undefined);
|
|
872
880
|
}
|
|
873
881
|
// ── 10. 复用 Agent 创建流程的显式 Owner 绑定;不等待人工审批 ──
|
|
874
882
|
let binding;
|
|
@@ -57,9 +57,12 @@ export async function cmdTrigger(args) {
|
|
|
57
57
|
if (response.result.error)
|
|
58
58
|
console.log(response.result.error);
|
|
59
59
|
}
|
|
60
|
+
else if (sub === 'cancel') {
|
|
61
|
+
console.log(`✓ interrupted ${response.runId ?? response.result?.runId ?? rest[0] ?? ''}`);
|
|
62
|
+
}
|
|
60
63
|
else {
|
|
61
64
|
const verb = { create: 'created', set: 'created', update: 'updated', enable: 'enabled',
|
|
62
|
-
disable: 'disabled',
|
|
65
|
+
disable: 'disabled', delete: 'deleted', remove: 'deleted', rm: 'deleted' }[sub];
|
|
63
66
|
console.log(`✓ ${verb} ${response.trigger.id}${['create', 'set', 'update'].includes(sub) ? ` (${response.trigger.name})` : ''}`);
|
|
64
67
|
}
|
|
65
68
|
return;
|
|
@@ -122,7 +125,7 @@ function printHelp() {
|
|
|
122
125
|
update [--agent <aid>] <triggerId> <参数...> [--if-revision <sha256:...>] [--json]
|
|
123
126
|
enable [--agent <aid>] <triggerId>
|
|
124
127
|
disable [--agent <aid>] <triggerId>
|
|
125
|
-
cancel [--agent <aid>] <
|
|
128
|
+
cancel [--agent <aid>] <runId> (中止当前活动运行)
|
|
126
129
|
delete|remove|rm [--agent <aid>] <triggerId>
|
|
127
130
|
run [--agent <aid>] <triggerId> [--dry-run] [--json]
|
|
128
131
|
template list|show <name> [--json]
|
|
@@ -136,7 +139,6 @@ Create 参数模式支持:
|
|
|
136
139
|
--script-path <路径> --script-runtime <node|python|bash>
|
|
137
140
|
--script-args <JSON> --script-timeout <时长>
|
|
138
141
|
--feedback <target|event-session> (event-session 使用事件来源会话)
|
|
139
|
-
--baseagent <name> (仅 --exec trigger-session)
|
|
140
142
|
--execution-timeout <时长>(模型类 Trigger 单次执行总时限)
|
|
141
143
|
--model <模型> --effort <low|medium|high|xhigh|max>
|
|
142
144
|
--max-runs <次数> --max-duration <时长: 30s|15m|2h|1d>
|
|
@@ -166,7 +168,7 @@ Update 参数:
|
|
|
166
168
|
--feedback <origin|target|event-session|silent>
|
|
167
169
|
--target-channel <channelKey> --target-channel-id <ID> (必须同时指定)
|
|
168
170
|
--target-chat-type <private|group> --target-session <main|thread> [--target-thread-id <threadId>]
|
|
169
|
-
--trigger-thread <by-run|by-trigger>
|
|
171
|
+
--trigger-thread <by-run|by-trigger>
|
|
170
172
|
--on-error <fail|retry> --noop-sentinel <文本>
|
|
171
173
|
--retry-attempts <次数> --retry-backoff <毫秒>
|
|
172
174
|
--script-runtime <node|python|bash> --script-args <JSON> --script-timeout <时长>
|
|
@@ -225,7 +227,7 @@ async function showTrigger(args, json, response) {
|
|
|
225
227
|
}
|
|
226
228
|
console.log(`execution: ${t.execution.type}`);
|
|
227
229
|
if (t.execution.type === 'trigger_session')
|
|
228
|
-
console.log(
|
|
230
|
+
console.log('baseagent: inherit (所属 Agent 当前基座)');
|
|
229
231
|
if (t.execution.type === 'script')
|
|
230
232
|
console.log(`script: ${scriptCommandLabel(t.execution.script)}`);
|
|
231
233
|
console.log(`model: ${t.execution.model ?? 'inherit'}`);
|
|
@@ -350,7 +352,6 @@ export async function buildTriggerCreateRequest(args, fileScope, defaultAgentAid
|
|
|
350
352
|
...(parsed.permissionMode ? { permissionMode: parsed.permissionMode } : {}),
|
|
351
353
|
...(parsed.executionType === 'trigger_session' ? {
|
|
352
354
|
thread: parsed.triggerThread ?? 'by_trigger',
|
|
353
|
-
...(parsed.baseagent ? { baseagent: parsed.baseagent } : {}),
|
|
354
355
|
} : {}),
|
|
355
356
|
onError: 'retry',
|
|
356
357
|
noopSentinel: '[[NOOP]]',
|
|
@@ -504,14 +505,19 @@ export function resolveTriggerCommandArgv(argv, defaultAgentAid) {
|
|
|
504
505
|
throw new Error(`Unknown trigger command: ${sub}`);
|
|
505
506
|
const agentAid = flagValue(args, '--agent') ?? defaultAgentAid;
|
|
506
507
|
const valueFlags = ['--agent', '--format', '--limit', '--if-revision', '--prompt-file', '--script-file'];
|
|
507
|
-
const
|
|
508
|
-
if (!['list', 'history', 'create', 'set'].includes(sub) && !
|
|
509
|
-
throw new Error('missing triggerId');
|
|
508
|
+
const positional = ['list', 'create', 'set'].includes(sub) ? undefined : optionalPositional(args, 0, valueFlags);
|
|
509
|
+
if (!['list', 'history', 'create', 'set'].includes(sub) && !positional) {
|
|
510
|
+
throw new Error(sub === 'cancel' ? 'missing runId' : 'missing triggerId');
|
|
511
|
+
}
|
|
510
512
|
const limit = Number(flagValue(args, '--limit') ?? 100);
|
|
511
513
|
if (!Number.isInteger(limit) || limit <= 0 || limit > 10_000)
|
|
512
514
|
throw new Error('Invalid history limit');
|
|
513
|
-
return {
|
|
514
|
-
|
|
515
|
+
return {
|
|
516
|
+
type: types[sub], agentAid,
|
|
517
|
+
...(sub === 'cancel' ? { runId: positional } : { triggerId: positional }),
|
|
518
|
+
limit, all: hasFlag(args, '--all'),
|
|
519
|
+
enabled: sub === 'enable', dryRun: hasFlag(args, '--dry-run')
|
|
520
|
+
};
|
|
515
521
|
}
|
|
516
522
|
function triggerUpdateArgs(args) {
|
|
517
523
|
const out = [];
|
|
@@ -585,11 +591,11 @@ async function setEnabled(args, enabled, json) {
|
|
|
585
591
|
}
|
|
586
592
|
async function cancelTrigger(args, json) {
|
|
587
593
|
const agentAid = resolveAgentAid(args);
|
|
588
|
-
const
|
|
589
|
-
const res = await request({ type: 'trigger.cancel', agentAid,
|
|
594
|
+
const runId = positional(args, 0, ['--agent', '--format']);
|
|
595
|
+
const res = await request({ type: 'trigger.cancel', agentAid, runId });
|
|
590
596
|
if (json)
|
|
591
597
|
return printJson(res);
|
|
592
|
-
console.log(`✓
|
|
598
|
+
console.log(`✓ interrupted ${res.runId ?? res.result?.runId ?? runId}`);
|
|
593
599
|
}
|
|
594
600
|
async function deleteTrigger(args, json) {
|
|
595
601
|
const agentAid = resolveAgentAid(args);
|
package/dist/config/boot-log.js
CHANGED
|
@@ -15,7 +15,7 @@ import { logger } from '../utils/logger.js';
|
|
|
15
15
|
import { autoMigrateIfNeeded } from '../config-store.js';
|
|
16
16
|
import { ConfigTarget, initConfigManager, notifyConfigWrite } from './config-manager.js';
|
|
17
17
|
import { ensureRoleConfigV4OnStartup, ensureRoleConfigV5OnStartup } from './role-migration-startup.js';
|
|
18
|
-
import { ensureAccessPolicyMigrationOnStartup, ensureAgentModelProviderMigrationOnStartup, ensureAgentOnlyModelMigrationOnStartup, ensureAuxiliaryModelMigrationOnStartup, ensurePeerFileRenameOnStartup, ensureProviderServiceTypeMigrationOnStartup, ensureRelationConfigVersionMigrationOnStartup, invalidateMigrationReadCache, withMigrationReadCache, } from './schema-migration.js';
|
|
18
|
+
import { ensureAccessPolicyMigrationOnStartup, ensureAgentModelProviderMigrationOnStartup, ensureAgentOnlyModelMigrationOnStartup, ensureAuxiliaryModelMigrationOnStartup, ensurePeerFileRenameOnStartup, ensurePublishedSchemaConsolidationMigrationOnStartup, ensureProviderServiceTypeMigrationOnStartup, ensureRelationConfigVersionMigrationOnStartup, invalidateMigrationReadCache, withMigrationReadCache, } from './schema-migration.js';
|
|
19
19
|
import { ensureContactBookV2OnStartup } from './peer-book-v2-startup.js';
|
|
20
20
|
import { synchronizeAllManagementPeersSync } from './peer-book-store.js';
|
|
21
21
|
import { readInstalledEvolcoreVersion, readFastaunVersion } from '../utils/evolcore-version.js';
|
|
@@ -38,7 +38,10 @@ export async function prepareStartupConfig(recoverRoleMutations, onStep) {
|
|
|
38
38
|
step('auxiliaryModel');
|
|
39
39
|
// 任一迁移真的落盘后立刻丢弃缓存:这三个迁移改的是同一批 relation 配置,
|
|
40
40
|
// 后一个迁移若沿用写盘前的旧文本做整文件覆盖,会把前一个的改动回滚掉。
|
|
41
|
-
const { auxiliaryModelMigration, agentOnlyModelMigration, relationVersionMigration } = await withMigrationReadCache(async () => {
|
|
41
|
+
const { publishedSchemaConsolidationMigration, auxiliaryModelMigration, agentOnlyModelMigration, relationVersionMigration } = await withMigrationReadCache(async () => {
|
|
42
|
+
const publishedSchemaConsolidation = await ensurePublishedSchemaConsolidationMigrationOnStartup();
|
|
43
|
+
if (publishedSchemaConsolidation)
|
|
44
|
+
invalidateMigrationReadCache();
|
|
42
45
|
const auxiliary = await ensureAuxiliaryModelMigrationOnStartup();
|
|
43
46
|
if (auxiliary)
|
|
44
47
|
invalidateMigrationReadCache();
|
|
@@ -49,11 +52,18 @@ export async function prepareStartupConfig(recoverRoleMutations, onStep) {
|
|
|
49
52
|
if (relationVersion)
|
|
50
53
|
invalidateMigrationReadCache();
|
|
51
54
|
return {
|
|
55
|
+
publishedSchemaConsolidationMigration: publishedSchemaConsolidation,
|
|
52
56
|
auxiliaryModelMigration: auxiliary,
|
|
53
57
|
agentOnlyModelMigration: agentOnly,
|
|
54
58
|
relationVersionMigration: relationVersion,
|
|
55
59
|
};
|
|
56
60
|
});
|
|
61
|
+
if (publishedSchemaConsolidationMigration) {
|
|
62
|
+
const message = `✓ Published schema consolidation applied automatically: ${publishedSchemaConsolidationMigration.changedFiles} file(s) restamped`
|
|
63
|
+
+ (publishedSchemaConsolidationMigration.backup ? `; backup: ${publishedSchemaConsolidationMigration.backup}` : '');
|
|
64
|
+
logger.info(message);
|
|
65
|
+
console.error(message);
|
|
66
|
+
}
|
|
57
67
|
if (auxiliaryModelMigration) {
|
|
58
68
|
const message = `✓ Session Renew auxiliary model migration applied automatically: ${auxiliaryModelMigration.changedFiles} file(s)`
|
|
59
69
|
+ (auxiliaryModelMigration.backup ? `; backup: ${auxiliaryModelMigration.backup}` : '');
|
|
@@ -146,6 +146,8 @@ export function resolveConfigFieldRule(fieldPath, scope) {
|
|
|
146
146
|
// 仅 agent-config 声明该字段,relation/defaults 由 schema 路由拒绝。
|
|
147
147
|
if (field === 'baseagentSkills')
|
|
148
148
|
return scalar(field, 'boolean', 'owner-only');
|
|
149
|
+
if (field === 'bootstrapWelcome')
|
|
150
|
+
return scalar(field, 'boolean', 'owner-only');
|
|
149
151
|
if (field === 'ability')
|
|
150
152
|
return readonlyObject('ability');
|
|
151
153
|
if (field === 'ability.codeApproval.enabled')
|
|
@@ -662,9 +662,9 @@ export function read(target, sel, opts = {}) {
|
|
|
662
662
|
const normalized = target === ConfigTarget.Process
|
|
663
663
|
? normalizeProcessConfigCompat(normalizeDaemonServices(migrated))
|
|
664
664
|
: target === ConfigTarget.Agent
|
|
665
|
-
? normalizeGroupChatmodeCompat(normalizeAgentConfigForRead(migrated, sel?.self))
|
|
665
|
+
? normalizeGroupChatmodeCompat(normalizeAgentConfigForRead(migrated, sel?.self), 18)
|
|
666
666
|
: target === ConfigTarget.Relation
|
|
667
|
-
? normalizeGroupChatmodeCompat(foldLegacyProactiveBlock(migrated))
|
|
667
|
+
? normalizeGroupChatmodeCompat(foldLegacyProactiveBlock(migrated), 11)
|
|
668
668
|
: target === ConfigTarget.Role
|
|
669
669
|
? normalizeRoleGroupChatmodeCompat(normalizeRoleEffortCompat(migrated))
|
|
670
670
|
: migrated;
|
|
@@ -882,7 +882,12 @@ function normalizeRelationConfigForWrite(value) {
|
|
|
882
882
|
normalizeShowActivitiesCompat(mutable);
|
|
883
883
|
return mutable;
|
|
884
884
|
}
|
|
885
|
-
|
|
885
|
+
/** A version limit keeps schema-backed reads compatible only with published configs. */
|
|
886
|
+
function normalizeGroupChatmodeCompat(value, maxLegacyVersion) {
|
|
887
|
+
const version = value?.$schema_version;
|
|
888
|
+
if (maxLegacyVersion !== undefined && version !== undefined
|
|
889
|
+
&& (typeof version !== 'number' || version > maxLegacyVersion))
|
|
890
|
+
return value;
|
|
886
891
|
if (value?.chatmode?.group !== 'interactive')
|
|
887
892
|
return value;
|
|
888
893
|
return { ...value, chatmode: { ...value.chatmode, group: 'proactive' } };
|
|
@@ -1439,7 +1444,7 @@ export function validateConfigFile(target, sel) {
|
|
|
1439
1444
|
}
|
|
1440
1445
|
if ((target === ConfigTarget.Agent || target === ConfigTarget.Relation)
|
|
1441
1446
|
&& sanitized && typeof sanitized === 'object') {
|
|
1442
|
-
sanitized = normalizeGroupChatmodeCompat(sanitized);
|
|
1447
|
+
sanitized = normalizeGroupChatmodeCompat(sanitized, target === ConfigTarget.Agent ? 18 : 11);
|
|
1443
1448
|
}
|
|
1444
1449
|
if (target === ConfigTarget.Role) {
|
|
1445
1450
|
sanitized = normalizeRoleGroupChatmodeCompat(normalizeRoleEffortCompat(sanitized));
|