evolcore 0.0.43-test.2 → 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 +44 -1
- 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 +138 -36
- package/dist/aun/aid/agentmd.js +52 -13
- 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/msg/p2p.js +4 -2
- package/dist/aun/service-proxy.js +3 -0
- package/dist/channels/aun.js +105 -53
- package/dist/channels/daemon.js +14 -2
- package/dist/cli/agent-command.js +5 -0
- package/dist/cli/agent-create.js +31 -11
- package/dist/cli/agent.js +9 -3
- package/dist/cli/aun-commands.js +19 -21
- package/dist/cli/daemon-commands.js +30 -18
- package/dist/cli/directory.js +98 -56
- package/dist/cli/getmeta-command.js +2 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/init.js +13 -5
- package/dist/cli/peer.js +2 -1
- package/dist/cli/task-context.js +3 -1
- package/dist/cli/trigger-command.js +20 -14
- package/dist/config/access-policy.js +0 -1
- package/dist/config/boot-log.js +12 -2
- package/dist/config/builtin-role-templates.js +2 -2
- package/dist/config/builtin-roles.js +2 -1
- package/dist/config/config-field-policy.js +7 -0
- package/dist/config/config-manager.js +30 -10
- package/dist/config/peer-role-resolver.js +23 -1
- package/dist/config/role-schema.js +25 -1
- package/dist/config/role-service.js +9 -4
- package/dist/config/role-store.js +30 -8
- 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 +14 -4
- package/dist/core/auth/operation-authorizer.js +19 -1
- package/dist/core/auth/operation-catalog.js +12 -2
- 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/channel-runtime.js +5 -0
- package/dist/core/command/agent-control.js +5 -2
- package/dist/core/command/agentmd-menu-request.js +50 -0
- package/dist/core/command/agentmd-menu.js +156 -0
- package/dist/core/command/chatmode-config.js +46 -0
- package/dist/core/command/command-handler.js +44 -17
- package/dist/core/command/daemon-diagnostics.js +2 -1
- package/dist/core/command/menu-catalog.js +14 -1
- package/dist/core/command/menu-handler.js +74 -24
- package/dist/core/command/menu-protocol.js +8 -0
- package/dist/core/command/role-menu.js +23 -9
- package/dist/core/command/slash-handler.js +52 -47
- package/dist/core/daemon-lifecycle.js +43 -17
- package/dist/core/event-catalog.js +19 -0
- package/dist/core/evolagent-registry.js +3 -0
- package/dist/core/evolagent.js +5 -4
- package/dist/core/ipc-registration.js +6 -0
- package/dist/core/lifecycle-notice.js +185 -0
- package/dist/core/message/aun-ipc-sender.js +30 -24
- package/dist/core/message/contact-admission.js +1 -19
- package/dist/core/message/im-renderer.js +81 -40
- package/dist/core/message/message-admission.js +21 -62
- package/dist/core/message/message-bridge.js +18 -5
- package/dist/core/message/message-utils.js +9 -0
- package/dist/core/message/peer-mode.js +16 -8
- package/dist/core/message/response-engine.js +67 -47
- 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 +74 -36
- package/dist/core/permission/ec-command-parser.js +62 -13
- package/dist/core/plugin-lifecycle.js +6 -2
- package/dist/core/relation/pa-team.js +132 -0
- package/dist/core/role/runtime-policy.js +4 -3
- package/dist/core/thread/thread-service.js +6 -4
- package/dist/directory/owner-directory-admission.js +0 -3
- package/dist/directory/owner-directory-cache.js +201 -17
- package/dist/directory/owner-directory-markdown.js +44 -21
- package/dist/directory/owner-directory-policy.js +1 -1
- package/dist/directory/owner-directory-query-operation.js +218 -98
- package/dist/directory/owner-directory-request-operation.js +76 -0
- package/dist/directory/owner-directory-scope.js +35 -4
- package/dist/directory/owner-directory-search.js +76 -23
- package/dist/directory/owner-directory-store.js +5 -38
- package/dist/directory/owner-directory-text.js +60 -0
- package/dist/eck/kit-renderer.js +6 -3
- package/dist/eck/message-renderer.js +2 -5
- package/dist/ecweb/message-context-service.js +4 -0
- package/dist/ecweb/runtime/lifecycle.js +29 -5
- package/dist/ecweb/runtime/supervisor.js +83 -27
- package/dist/index.js +209 -38
- package/dist/paths.js +4 -2
- package/dist/product.js +1 -0
- package/dist/proxy/service-supervisor.js +377 -141
- package/dist/response-system/engines/v1/index.js +2 -4
- package/dist/response-system/modes/single-session/index.js +1 -1
- 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 +53 -13
- package/dist/trigger/validation.js +0 -13
- package/dist/utils/error-utils.js +15 -5
- 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/README.md +18 -0
- package/ecagent/dist/harness/agent-harness.d.ts +2 -0
- package/ecagent/dist/harness/agent-harness.js +24 -8
- package/ecagent/dist/harness/compaction/branch-summarization.js +1 -1
- package/ecagent/dist/harness/compaction/compaction.js +7 -4
- package/ecagent/dist/harness/types.d.ts +1 -0
- package/kits/docs/channels/aun.md +1 -1
- package/kits/docs/context-assembly.md +1 -1
- package/kits/docs/evolcore/INDEX.md +5 -2
- package/kits/docs/evolcore/directory.md +125 -35
- package/kits/docs/evolcore/ecweb-lifecycle.md +26 -0
- package/kits/docs/evolcore/file-navigation.md +279 -0
- package/kits/docs/evolcore/menu-protocol.md +1 -0
- package/kits/docs/evolcore/model.md +5 -3
- package/kits/docs/evolcore/msg.md +1 -0
- package/kits/docs/evolcore/peer.md +2 -1
- package/kits/docs/evolcore/response.md +4 -2
- package/kits/docs/evolcore/task.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/docs/identity/ROLE_DETAIL.md +2 -0
- package/kits/eck_manifest.json +6 -23
- package/kits/eck_manifest.memory.json +26 -1
- 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 +10 -10
- 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/schemas/role-registry.schema.1.json +3 -2
- package/kits/skills/ec-service-proxy/SKILL.md +10 -0
- package/kits/skills/ec-trigger/SKILL.md +1 -1
- package/kits/templates/soul/00-GUIDE.md +20 -42
- package/kits/templates/system-fragments/channel.md +2 -2
- package/kits/templates/system-fragments/commands.md +1 -1
- package/kits/templates/system-fragments/directory-contacts.md +1 -1
- package/kits/templates/system-fragments/identity.md +0 -1
- package/kits/templates/system-fragments/personal-assistant.md +2 -17
- package/kits/templates/system-fragments/reply.md +7 -0
- package/kits/templates/system-fragments/session.md +6 -2
- package/package.json +18 -13
- package/dist/eck/paactive-context.js +0 -45
- package/dist/response-system/engines/v1/paactive-flow.js +0 -18
- package/kits/eck_manifest.paactive.json +0 -528
- package/kits/eck_message_manifest.paactive.json +0 -233
- package/kits/templates/message-fragments/paactive/item.md +0 -3
- package/kits/templates/system-fragments/paactive/channel.md +0 -25
- package/kits/templates/system-fragments/paactive/reply.md +0 -25
- package/kits/templates/system-fragments/paactive/session.md +0 -32
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,21 +228,29 @@ 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 };
|
|
240
250
|
const existingBehavior = cfgRead(ConfigTarget.Agent, sel) || {};
|
|
241
|
-
//
|
|
242
|
-
// 交 Owner 审核,而不是静默丢弃。已有的 access 策略(含 --force 重建)原样保留。
|
|
251
|
+
// New agents use app-v1 in code; these values control only explicit openness rules.
|
|
243
252
|
if (!existingBehavior.access) {
|
|
244
253
|
behavior.access = {
|
|
245
|
-
contactAdmission: 'app-v1',
|
|
246
254
|
allowInternalContacts: true,
|
|
247
255
|
allowExternalContacts: false,
|
|
248
256
|
allowAllContacts: false,
|
|
@@ -552,6 +560,17 @@ export async function agentCreateNonInteractive(opts, runtime = {}) {
|
|
|
552
560
|
return failValidating('ecagent is optional; pass --baseagent ecagent to select it explicitly');
|
|
553
561
|
baseagent = defaultBaseagent;
|
|
554
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
|
+
}
|
|
555
574
|
if (!path.isAbsolute(opts.project))
|
|
556
575
|
return failValidating(`--project must be absolute: ${opts.project}`);
|
|
557
576
|
if (!fs.existsSync(opts.project)) {
|
|
@@ -611,7 +630,7 @@ export async function agentCreateNonInteractive(opts, runtime = {}) {
|
|
|
611
630
|
opts.onPhase?.('config_saved', 'begin');
|
|
612
631
|
saveAgent({ $schema_version: CONFIG_SCHEMA_VERSION, aid: opts.aid, enabled: true, lifecycle: preservedLifecycle, channels: [], projects: { defaultPath: opts.project } });
|
|
613
632
|
ensureInitialRoleRegistry(opts.aid);
|
|
614
|
-
saveInitialBehavior(opts.aid, baseagent);
|
|
633
|
+
saveInitialBehavior(opts.aid, baseagent, provider);
|
|
615
634
|
ensureAgentDirSkeleton(opts.aid);
|
|
616
635
|
opts.onPhase?.('config_saved', 'done');
|
|
617
636
|
opts.onPhase?.('uploading_agentmd', 'begin');
|
|
@@ -1107,8 +1126,8 @@ export function validateInitializationPlan(plan) {
|
|
|
1107
1126
|
if (plan.chatmode !== undefined) {
|
|
1108
1127
|
if (!plan.chatmode || typeof plan.chatmode !== 'object' || Array.isArray(plan.chatmode)
|
|
1109
1128
|
|| Object.entries(plan.chatmode).some(([scope, value]) => !['private', 'group', 'nothuman'].includes(scope)
|
|
1110
|
-
|| !['interactive', 'proactive', ...(scope === 'private' ? ['paactive'] : [])].includes(value))) {
|
|
1111
|
-
failure('INVALID_ARGS', 'chatmode must
|
|
1129
|
+
|| !(scope === 'group' ? ['proactive'] : ['interactive', 'proactive', ...(scope === 'private' ? ['paactive'] : [])]).includes(value))) {
|
|
1130
|
+
failure('INVALID_ARGS', 'chatmode.group must be proactive; paactive is private AUN only');
|
|
1112
1131
|
}
|
|
1113
1132
|
}
|
|
1114
1133
|
if (plan.avatarFile !== undefined && plan.avatarUrl !== undefined)
|
|
@@ -1988,7 +2007,7 @@ export function parseInitializationArgs(args) {
|
|
|
1988
2007
|
throw new Error('--bootstrap cannot initialize an agent');
|
|
1989
2008
|
const booleans = new Set(resume ? ['--resume'] : ['--initialize', '--non-interactive', '--dry-run']);
|
|
1990
2009
|
const strings = new Set(resume ? ['--wait', '--format', '--client-request-id'] : [
|
|
1991
|
-
'--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',
|
|
1992
2011
|
'--persona-file', '--persona-text', '--wait', '--format',
|
|
1993
2012
|
]);
|
|
1994
2013
|
const seen = new Set();
|
|
@@ -2037,7 +2056,7 @@ export function resolveInitializationPlan(args, context) {
|
|
|
2037
2056
|
? readInitializationPersona(v['--persona-file'], !!context, context)
|
|
2038
2057
|
: v['--persona-text'];
|
|
2039
2058
|
const p = resolveAgentCreatePlan({
|
|
2040
|
-
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),
|
|
2041
2060
|
avatarFile: v['--avatar-file'], avatarUrl: v['--avatar-url'],
|
|
2042
2061
|
name: v['--name'], description: v['--description'], tags: parseAgentTags(v['--tags']), type: v['--type'],
|
|
2043
2062
|
}, context?.projectCwd);
|
|
@@ -2045,6 +2064,7 @@ export function resolveInitializationPlan(args, context) {
|
|
|
2045
2064
|
const effort = v['--effort']?.trim();
|
|
2046
2065
|
return {
|
|
2047
2066
|
aid: p.aid, project: p.project, baseagent: p.baseagent ?? '',
|
|
2067
|
+
...(v['--provider']?.trim() ? { provider: v['--provider'].trim() } : {}),
|
|
2048
2068
|
...(model ? { model } : {}),
|
|
2049
2069
|
...(effort && effort !== 'auto' ? { effort } : {}),
|
|
2050
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
|
@@ -197,6 +197,16 @@ async function runManagedAid(args, formatJson) {
|
|
|
197
197
|
console.log(`✓ 头像已更新${response.result.avatar ? `: ${response.result.avatar}` : ''}${response.result.sha256 ? ` (sha256: ${response.result.sha256})` : ''}`);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* handoff 只是内部投递实例,不属于对外回执。回执与 JSON 结果统一剥掉该字段,
|
|
202
|
+
* 调用方只看 message_id;需要排查时查运行日志。
|
|
203
|
+
*/
|
|
204
|
+
function stripHandoff(result) {
|
|
205
|
+
if (!result || typeof result !== 'object' || !('handoff_id' in result))
|
|
206
|
+
return result;
|
|
207
|
+
const { handoff_id: _handoffId, ...rest } = result;
|
|
208
|
+
return rest;
|
|
209
|
+
}
|
|
200
210
|
function failManagedGroup(formatJson, code, error, details = {}) {
|
|
201
211
|
if (formatJson)
|
|
202
212
|
console.log(JSON.stringify({ ok: false, code, error, ...details }));
|
|
@@ -1491,8 +1501,8 @@ Options:
|
|
|
1491
1501
|
*
|
|
1492
1502
|
* 使用 `interval` 而非 `delay`:周期触发,由显式
|
|
1493
1503
|
* `ec trigger delete`(结束,不留残留)/ `ec trigger update --every <新时长>`(调整周期)改变状态。
|
|
1494
|
-
* `ec trigger
|
|
1495
|
-
* 不该走
|
|
1504
|
+
* `ec trigger disable` 只停用后续调度,定义仍留在磁盘上,复查这种用完即弃的 Trigger
|
|
1505
|
+
* 不该走 disable,否则会积压大量永不触发的死定义。
|
|
1496
1506
|
* 一次性 Trigger 会静默消失,无法承担「一直跟进直到显式结束」的语义。
|
|
1497
1507
|
*/
|
|
1498
1508
|
export function buildThreadCheckTrigger(input) {
|
|
@@ -2368,15 +2378,10 @@ Options:
|
|
|
2368
2378
|
console.log(`request_id=${result.request_id} state=${result.request_state ?? '-'} message_id=${result.message_id ?? '-'}`);
|
|
2369
2379
|
}
|
|
2370
2380
|
else if (formatJson) {
|
|
2371
|
-
console.log(JSON.stringify(result));
|
|
2381
|
+
console.log(JSON.stringify(stripHandoff(result)));
|
|
2372
2382
|
}
|
|
2373
2383
|
else {
|
|
2374
|
-
|
|
2375
|
-
console.log(`✓ handoff ${result.handoff_id} 已投递 ${result.message_id ?? ''}`.trimEnd());
|
|
2376
|
-
else if (result.handoff_id)
|
|
2377
|
-
console.log(`✓ 已排队 handoff ${result.handoff_id}(尚未投递)`);
|
|
2378
|
-
else
|
|
2379
|
-
console.log(`✓ 已发送 ${result.message_id ?? ''} seq=${result.seq ?? '-'} status=${result.status ?? '-'}`);
|
|
2384
|
+
console.log(`✓ 已发送 message_id=${result.message_id ?? '-'} seq=${result.seq ?? '-'} status=${result.status ?? '-'}`);
|
|
2380
2385
|
}
|
|
2381
2386
|
return;
|
|
2382
2387
|
}
|
|
@@ -2782,7 +2787,7 @@ g- 是名称的一部分,会完整保留;默认命名格式为 g-10000 至 g
|
|
|
2782
2787
|
const outputResult = (result, successHuman) => {
|
|
2783
2788
|
if (!result.ok) {
|
|
2784
2789
|
if (formatJson) {
|
|
2785
|
-
console.log(JSON.stringify(result));
|
|
2790
|
+
console.log(JSON.stringify(stripHandoff(result)));
|
|
2786
2791
|
}
|
|
2787
2792
|
else {
|
|
2788
2793
|
console.error(`❌ ${result.error}`);
|
|
@@ -2790,7 +2795,7 @@ g- 是名称的一部分,会完整保留;默认命名格式为 g-10000 至 g
|
|
|
2790
2795
|
process.exit(1);
|
|
2791
2796
|
}
|
|
2792
2797
|
if (formatJson) {
|
|
2793
|
-
console.log(JSON.stringify(result));
|
|
2798
|
+
console.log(JSON.stringify(stripHandoff(result)));
|
|
2794
2799
|
}
|
|
2795
2800
|
else {
|
|
2796
2801
|
successHuman();
|
|
@@ -3036,12 +3041,7 @@ g- 是名称的一部分,会完整保留;默认命名格式为 g-10000 至 g
|
|
|
3036
3041
|
}
|
|
3037
3042
|
outputResult(result, () => {
|
|
3038
3043
|
const r = result;
|
|
3039
|
-
|
|
3040
|
-
console.log(`✓ handoff ${r.handoff_id} 已投递 ${r.message_id ?? ''}`.trimEnd());
|
|
3041
|
-
else if (r.handoff_id)
|
|
3042
|
-
console.log(`✓ 已排队 handoff ${r.handoff_id}(尚未投递)`);
|
|
3043
|
-
else
|
|
3044
|
-
console.log(`✓ 已发送 message_id=${r.message_id ?? r.message?.message_id ?? '-'} seq=${r.message?.seq ?? '-'}`);
|
|
3044
|
+
console.log(`✓ 已发送 message_id=${r.message_id ?? r.message?.message_id ?? '-'} seq=${r.message?.seq ?? '-'}`);
|
|
3045
3045
|
});
|
|
3046
3046
|
return;
|
|
3047
3047
|
}
|
|
@@ -3568,13 +3568,11 @@ async function runManagedSend(argv, formatJson) {
|
|
|
3568
3568
|
...(result.contact_request ? { contact_request: result.contact_request } : {}),
|
|
3569
3569
|
});
|
|
3570
3570
|
if (formatJson)
|
|
3571
|
-
console.log(JSON.stringify(result));
|
|
3572
|
-
else if (result.handoff_id)
|
|
3573
|
-
console.log(`✓ handoff ${result.handoff_id} ${result.status === 'delivered' ? '已投递' : '已排队'} ${result.message_id ?? ''}`.trimEnd());
|
|
3571
|
+
console.log(JSON.stringify(stripHandoff(result)));
|
|
3574
3572
|
else if (result.request_id)
|
|
3575
3573
|
console.log(`sent message_id=${result.message_id ?? '-'} request_id=${result.request_id} state=${result.request_state ?? '-'}`);
|
|
3576
3574
|
else
|
|
3577
|
-
console.log(`✓ 已发送 message_id=${result.message_id ?? '-'} seq=${result.seq ?? result.message?.seq ?? '-'}`);
|
|
3575
|
+
console.log(`✓ 已发送 message_id=${result.message_id ?? '-'} seq=${result.seq ?? result.message?.seq ?? '-'} status=${result.status ?? '-'}`);
|
|
3578
3576
|
// 复查 Trigger 结果必须可见:消息已发出所以不改退出码(避免调用方重发),
|
|
3579
3577
|
// 但没建成要明说,别让调用方以为"N 分钟后会自动复查"。
|
|
3580
3578
|
if (!formatJson) {
|
|
@@ -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
|
@@ -2,16 +2,16 @@ import { resolvePaths } from '../paths.js';
|
|
|
2
2
|
import { daemonUnavailableMessage, getArgValue, isHelpFlag, queryDaemon, wantsHelp } from './help.js';
|
|
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
|
+
const QUERY_ACTIONS = new Set(['list', 'info', 'refresh', 'blocked']);
|
|
6
7
|
/**
|
|
7
8
|
* `ec directory ...`
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
+
* 查询、重算注入与发起联系人邀请。**备注不走命令**:它是一个 frontmatter markdown 文件,由 Agent
|
|
10
11
|
* 直接读写自己目录下的 `<agent>/directory/remarks/<联系人AID>.md`,改完再
|
|
11
12
|
* `ec directory refresh` 让 `directory.md` 重算。
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
-
* 包一层 CLI + daemon IPC 只是把「写一个文件」变复杂。
|
|
14
|
+
* 命令面与 `ec skill` 对齐:`list` 列举/过滤(含分页),`info` 看单条详情。
|
|
15
15
|
*/
|
|
16
16
|
export async function cmdDirectory(args) {
|
|
17
17
|
if (args.length === 0 || isHelpFlag(args[0]) || wantsHelp(args)) {
|
|
@@ -19,13 +19,14 @@ export async function cmdDirectory(args) {
|
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
const action = args[0];
|
|
22
|
-
if (!QUERY_ACTIONS.has(action)) {
|
|
22
|
+
if (!QUERY_ACTIONS.has(action) && action !== 'request') {
|
|
23
23
|
console.error(`❌ 未知子命令: ${action}`);
|
|
24
24
|
printHelp();
|
|
25
25
|
process.exitCode = 1;
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
// 与 `ec skill list` 对齐:`--json` 是 `--format json` 的同义写法。
|
|
29
|
+
const json = getArgValue(args, '--format') === 'json' || args.includes('--json');
|
|
29
30
|
try {
|
|
30
31
|
const result = process.env.EVOLCORE_SESSION_ID
|
|
31
32
|
? await runManaged(args, json)
|
|
@@ -34,17 +35,37 @@ export async function cmdDirectory(args) {
|
|
|
34
35
|
}
|
|
35
36
|
catch (error) {
|
|
36
37
|
const known = error instanceof DirectoryQueryError;
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
39
|
+
fail(known ? error.code : 'DIRECTORY_OPERATION_FAILED', message, json);
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
async function runLocal(argv) {
|
|
43
|
+
if (argv[0] === 'request') {
|
|
44
|
+
const command = resolveDirectoryRequestCommand(argv);
|
|
45
|
+
const { msgSend } = await import('../aun/msg/index.js');
|
|
46
|
+
return executeDirectoryRequestCommand(command, input => msgSend({
|
|
47
|
+
from: input.from, to: input.to, body: { mode: 'payload', payload: input.payload }, encrypt: input.encrypt,
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
42
50
|
return executeDirectoryQueryCommand(resolveDirectoryQueryCommand(argv));
|
|
43
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* 失败输出:`--format json` 时要给出结构化结果。
|
|
54
|
+
*
|
|
55
|
+
* 之前无论 `--format json` 与否都只打印 `❌ <message>`,调用方拿不到错误码,
|
|
56
|
+
* 无法区分「人不在名录里」和「名录没授权/没快照」。结构化失败与成功结果保持
|
|
57
|
+
* 同一形状:`{ ok: false, code, error }`。
|
|
58
|
+
*/
|
|
59
|
+
function fail(code, message, json) {
|
|
60
|
+
if (json)
|
|
61
|
+
console.log(JSON.stringify({ ok: false, code, error: message }));
|
|
62
|
+
else
|
|
63
|
+
console.error(`❌ ${message}`);
|
|
64
|
+
process.exitCode = 1;
|
|
65
|
+
}
|
|
44
66
|
function output(result, json) {
|
|
45
67
|
if (!result.ok) {
|
|
46
|
-
|
|
47
|
-
process.exitCode = 1;
|
|
68
|
+
fail(result.code, result.error, json);
|
|
48
69
|
return;
|
|
49
70
|
}
|
|
50
71
|
if (json) {
|
|
@@ -52,19 +73,27 @@ function output(result, json) {
|
|
|
52
73
|
return;
|
|
53
74
|
}
|
|
54
75
|
switch (result.action) {
|
|
55
|
-
case '
|
|
56
|
-
|
|
57
|
-
|
|
76
|
+
case 'request': {
|
|
77
|
+
console.log(`✓ 已向 ${result.targetAid} 发送加密 friend.invite.v1 加好友申请,message_id=${result.message_id}`);
|
|
78
|
+
console.log('发送成功只表示申请已提交;请等待 Evol App 处理并同步联系人名录,再重试原消息。');
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
case 'list': {
|
|
82
|
+
if (result.entries.length === 0) {
|
|
83
|
+
console.log(result.total === 0 ? '(没有匹配)' : '(这一页没有条目)');
|
|
58
84
|
return;
|
|
59
85
|
}
|
|
60
|
-
for (const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
86
|
+
for (const entry of result.entries)
|
|
87
|
+
printListRow(entry);
|
|
88
|
+
printPageFooter(result);
|
|
89
|
+
console.log('名录详情:ec directory info <AID>;名片正文:ec aid agentmd get <AID>');
|
|
64
90
|
return;
|
|
65
91
|
}
|
|
66
|
-
case '
|
|
92
|
+
case 'info': {
|
|
67
93
|
// 按名字命中多条时全部列出,先给一行汇总,避免把第一条误当成唯一答案。
|
|
94
|
+
if (result.matchKind === 'fuzzy') {
|
|
95
|
+
console.log('(按名字包含匹配,可能不是同一个人;建议改用 AID 精确查)');
|
|
96
|
+
}
|
|
68
97
|
if (result.entries.length > 1) {
|
|
69
98
|
console.log(`按${result.matchedBy === 'name' ? '名字' : 'AID'}命中 ${result.entries.length} 条,逐条列出:`);
|
|
70
99
|
}
|
|
@@ -80,6 +109,8 @@ function output(result, json) {
|
|
|
80
109
|
console.log(`(另有 ${result.truncated} 条同名未列出,加 --limit 或按 AID 精确查)`);
|
|
81
110
|
if (result.synced)
|
|
82
111
|
console.log('(先做了一次同步)');
|
|
112
|
+
const aid = result.entries.length === 1 ? String(result.entries[0].aid ?? '') : '';
|
|
113
|
+
console.log(`名片正文:ec aid agentmd get ${aid || '<AID>'}`);
|
|
83
114
|
return;
|
|
84
115
|
}
|
|
85
116
|
case 'refresh': {
|
|
@@ -98,28 +129,29 @@ function output(result, json) {
|
|
|
98
129
|
}
|
|
99
130
|
return;
|
|
100
131
|
}
|
|
101
|
-
case 'list': {
|
|
102
|
-
if (result.entries.length === 0)
|
|
103
|
-
console.log('(没有条目)');
|
|
104
|
-
for (const entry of result.entries) {
|
|
105
|
-
const name = typeof entry.name === 'string' ? entry.name : '';
|
|
106
|
-
console.log([name && name !== entry.aid ? name : '', entry.aid, entry.type ?? '', entry.remark ?? '']
|
|
107
|
-
.filter(Boolean).join(' | '));
|
|
108
|
-
}
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
132
|
}
|
|
112
133
|
}
|
|
113
|
-
|
|
134
|
+
/** list 的一行:名字 | AID | type | exttype | 备注名 | 描述 | Owner | 归属。 */
|
|
135
|
+
function printListRow(entry) {
|
|
136
|
+
const text = (value) => (typeof value === 'string' ? value : '');
|
|
137
|
+
const name = text(entry.name);
|
|
114
138
|
const cells = [
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
139
|
+
name && name !== entry.aid ? name : '',
|
|
140
|
+
text(entry.aid),
|
|
141
|
+
text(entry.type),
|
|
142
|
+
text(entry.exttype),
|
|
143
|
+
text(entry.remark),
|
|
144
|
+
text(entry.description),
|
|
145
|
+
`Owner: ${text(entry.ownerAid) || '(无)'}`,
|
|
146
|
+
`归属: ${text(entry.ownershipStatus) || 'unknown'}${entry.ownershipVerified === true ? ' ✓' : ''}`,
|
|
147
|
+
`内外: ${entry.internal === true ? '内部' : '外部'}`,
|
|
120
148
|
].filter(Boolean);
|
|
121
|
-
|
|
122
|
-
|
|
149
|
+
console.log(cells.join(' | '));
|
|
150
|
+
}
|
|
151
|
+
function printPageFooter(result) {
|
|
152
|
+
const pages = Math.max(1, Math.ceil(result.total / result.limit));
|
|
153
|
+
const next = result.hasMore ? ';加 --page ' + (result.page + 1) + ' 看下一页' : '';
|
|
154
|
+
console.log(`(第 ${result.page}/${pages} 页,共 ${result.total} 条${next})`);
|
|
123
155
|
}
|
|
124
156
|
async function runManaged(argv, json) {
|
|
125
157
|
const sessionId = process.env.EVOLCORE_SESSION_ID;
|
|
@@ -132,7 +164,7 @@ async function runManaged(argv, json) {
|
|
|
132
164
|
argv: ['directory', ...argv],
|
|
133
165
|
sessionId,
|
|
134
166
|
delegationToken,
|
|
135
|
-
}, 15_000);
|
|
167
|
+
}, argv[0] === 'request' ? 30_000 : 15_000);
|
|
136
168
|
if (!response) {
|
|
137
169
|
throw new DirectoryQueryError('DAEMON_UNAVAILABLE', daemonUnavailableMessage(transportError, 'Unable to connect to the evolcore daemon'));
|
|
138
170
|
}
|
|
@@ -144,27 +176,33 @@ async function runManaged(argv, json) {
|
|
|
144
176
|
}
|
|
145
177
|
function printHelp() {
|
|
146
178
|
console.log(`用法:
|
|
147
|
-
ec directory
|
|
148
|
-
ec directory
|
|
149
|
-
ec directory
|
|
150
|
-
ec directory
|
|
151
|
-
ec directory
|
|
179
|
+
ec directory list [<关键词>] [--filter '<kw1,kw2>']... [--type <type>] [--scope internal|external|all] [--owner <aid|unbound>] [--limit <n>] [--page <n>]
|
|
180
|
+
ec directory info <contact-aid|名字> [--limit <n>]
|
|
181
|
+
ec directory refresh
|
|
182
|
+
ec directory blocked
|
|
183
|
+
ec directory request <target-aid> [--note <申请介绍>]
|
|
184
|
+
|
|
185
|
+
request:向目标发送 app-v1 friend.invite.v1 加好友申请;介绍默认为“你好,我想添加你为联系人。”。
|
|
186
|
+
发送成功仅表示申请已提交;须等 Evol App 处理并同步联系人名录后再重试原消息。
|
|
152
187
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
188
|
+
list:
|
|
189
|
+
列举名录;给关键词时按 AID、名字、备注、描述、exttype 做子串匹配(不区分大小写)。
|
|
190
|
+
--filter 与 ec skill list --filter 同语义:组内逗号分隔为 OR,多个 --filter 之间为 AND;
|
|
191
|
+
位置参数按“多个词同时命中”处理。
|
|
192
|
+
默认每页 20 条,--page / --limit 可翻页;输出包含 type、exttype、描述、备注、
|
|
193
|
+
Owner 绑定关系与 Ownership 核验状态。本地备注正文不在 list 展示。
|
|
157
194
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
195
|
+
info:
|
|
196
|
+
接受 AID 或名字。AID 大小写不敏感、可带 @ 前缀;名字先做归一后的精确匹配
|
|
197
|
+
(全角/半角、空格、结尾括号称呼不影响),没命中再按名字包含匹配,结果标
|
|
198
|
+
matchKind=fuzzy。返回完整记录(含本地备注正文)。
|
|
162
199
|
|
|
163
|
-
refresh
|
|
164
|
-
|
|
200
|
+
refresh:
|
|
201
|
+
拉一次最新名录并重算 directory.md / identity.json。拉取需要 channel 在线;
|
|
202
|
+
没有连接时只做本地重算——手工改完备注后用它把改动刷进名录。
|
|
165
203
|
|
|
166
|
-
blocked
|
|
167
|
-
|
|
204
|
+
blocked:
|
|
205
|
+
列出被拉黑的主体,合并名录侧(Owner 发布,跨 Agent)与本端(peers.json)两个来源。
|
|
168
206
|
|
|
169
207
|
备注不走命令:直接读写自己目录下的 <agent>/directory/remarks/<联系人AID>.md
|
|
170
208
|
|
|
@@ -177,7 +215,11 @@ blocked:列出被拉黑的主体,合并两个来源——名录的 blocked_a
|
|
|
177
215
|
<正文>
|
|
178
216
|
文件名必须与 aid 一致;remark 与正文可只写一个。改完调 ec directory refresh。
|
|
179
217
|
|
|
218
|
+
看名片正文(agent.md,下载+验签)用:ec aid agentmd get <AID>
|
|
219
|
+
|
|
180
220
|
选项:
|
|
181
|
-
--self <agent-aid> 目标 Agent
|
|
182
|
-
|
|
221
|
+
--self <agent-aid> 目标 Agent;托管会话缺省取当前任务所属 Agent(委托凭据),
|
|
222
|
+
否则取 EVOLCORE_SELF_AID
|
|
223
|
+
--format json 以 JSON 输出;失败时同样输出 { ok: false, code, error }
|
|
224
|
+
--json 等价于 --format json(与 ec skill list 对齐)`);
|
|
183
225
|
}
|
|
@@ -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/index.js
CHANGED
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;
|