evolcore 0.0.41-test.2 → 0.0.42-test.0
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 +38 -2
- package/bin/codex-managed-hook.mjs +9 -5
- package/dist/agents/baseagent.js +156 -16
- package/dist/agents/claude-runner.js +10 -3
- package/dist/agents/codex/catalog.js +8 -4
- package/dist/agents/codex-runner.js +236 -59
- package/dist/agents/ecagent-runner.js +82 -13
- package/dist/aun/aid/agentmd.js +106 -27
- package/dist/aun/aid/client.js +1 -1
- package/dist/aun/aid/control-aid.js +65 -13
- package/dist/aun/aid/identity.js +70 -4
- package/dist/aun/aid/index.js +2 -2
- package/dist/aun/service-proxy.js +25 -1
- package/dist/channels/aun.js +242 -209
- package/dist/channels/dingtalk.js +1 -1
- package/dist/channels/feishu.js +1 -1
- package/dist/channels/qqbot.js +1 -1
- package/dist/channels/wechat.js +1 -1
- package/dist/channels/wecom.js +1 -1
- package/dist/cli/agent-command.js +183 -3
- package/dist/cli/agent-create.js +92 -86
- package/dist/cli/agent.js +136 -1
- package/dist/cli/aun-commands.js +137 -35
- package/dist/cli/bench.js +8 -2
- package/dist/cli/command-log.js +1 -1
- package/dist/cli/daemon-commands.js +235 -51
- package/dist/cli/debug-mode.js +1 -1
- package/dist/cli/directory.js +170 -0
- package/dist/cli/index.js +40 -30
- package/dist/cli/init-channel.js +4 -4
- package/dist/cli/init.js +47 -32
- package/dist/cli/managed-command-guard.js +4 -1
- package/dist/cli/model.js +27 -18
- package/dist/cli/pa-workspace-command.js +191 -0
- package/dist/cli/{contact.js → peer.js} +19 -25
- package/dist/cli/restart-monitor.js +11 -4
- package/dist/cli/thread-command.js +47 -18
- package/dist/cli/version.js +18 -18
- package/dist/config/access-policy.js +29 -12
- package/dist/config/boot-log.js +65 -10
- package/dist/config/builtin-roles.js +2 -4
- package/dist/config/config-field-policy.js +3 -0
- package/dist/config/config-manager.js +28 -20
- package/dist/config/{contact-bind-code.js → peer-bind-code.js} +6 -6
- package/dist/config/{contact-book-store.js → peer-book-store.js} +75 -75
- package/dist/config/{contact-book-v2-startup.js → peer-book-v2-startup.js} +2 -2
- package/dist/config/{contact-book.js → peer-book.js} +47 -47
- package/dist/config/peer-operation-service.js +132 -0
- package/dist/config/{contact-request-service.js → peer-request-service.js} +90 -90
- package/dist/config/peer-role-resolver.js +3 -3
- package/dist/config/providers-config.js +17 -8
- package/dist/config/providers.js +1 -1
- package/dist/config/schema-migration.js +336 -39
- package/dist/core/agent-application-service.js +8 -2
- package/dist/core/agent-create-status.js +4 -5
- package/dist/core/agent-ipc-registration.js +5 -4
- package/dist/core/agent-runtime.js +30 -17
- package/dist/core/auth/operation-authorizer.js +0 -24
- package/dist/core/auth/operation-catalog.js +4 -20
- package/dist/core/baseagent-loader.js +27 -3
- package/dist/core/bootstrap-service.js +5 -22
- package/dist/core/capability/capability-manager.js +52 -35
- package/dist/core/channel-loader.js +43 -2
- package/dist/core/channel-runtime.js +2 -2
- package/dist/core/command/agent-control.js +54 -18
- package/dist/core/command/command-handler.js +92 -72
- package/dist/core/command/connect-menu.js +35 -42
- package/dist/core/command/daemon-diagnostics.js +41 -5
- package/dist/core/command/data-root-error.js +10 -0
- package/dist/core/command/data-root-resolver.js +53 -13
- package/dist/core/command/menu-catalog.js +1 -0
- package/dist/core/command/menu-handler.js +163 -65
- package/dist/core/command/menu-protocol.js +52 -0
- package/dist/core/command/pa-workspace-calendar.js +223 -0
- package/dist/core/command/pa-workspace-store.js +459 -0
- package/dist/core/command/role-menu.js +2 -2
- package/dist/core/command/slash-gate.js +1 -1
- package/dist/core/command/slash-handler.js +57 -41
- package/dist/core/daemon-lifecycle.js +90 -31
- package/dist/core/evolagent.js +6 -10
- package/dist/core/handoff/runtime.js +11 -4
- package/dist/core/host-snapshot.js +208 -0
- package/dist/core/initialization/service.js +152 -20
- package/dist/core/ipc-registration.js +33 -4
- package/dist/core/memory/batch-meta.js +27 -0
- package/dist/core/memory/consolidation-ops-records.js +44 -1
- package/dist/core/memory/consolidation.js +169 -27
- package/dist/core/message/aun-ipc-sender.js +2 -8
- package/dist/core/message/im-renderer.js +56 -3
- package/dist/core/message/message-admission.js +121 -124
- package/dist/core/message/message-bridge.js +38 -54
- package/dist/core/message/message-queue.js +7 -0
- package/dist/core/message/outbound.js +34 -9
- package/dist/core/message/response-engine.js +154 -73
- package/dist/core/model/catalog-service.js +1 -1
- package/dist/core/model/config-scope.js +2 -2
- package/dist/core/model/model-catalog.js +5 -4
- package/dist/core/model/model-diagnostics.js +6 -5
- package/dist/core/model/model-fallback.js +3 -6
- package/dist/core/model/model-permission.js +1 -1
- package/dist/core/ownership/owner-resolver.js +9 -9
- package/dist/core/permission/approval-gateway.js +1 -1
- package/dist/core/permission/ec-command-parser.js +2 -2
- package/dist/core/permission/tool-canonical.js +96 -46
- package/dist/core/permission/tool-error-code.js +41 -0
- package/dist/core/permission/tool-policy.js +71 -47
- package/dist/core/role/runtime-policy.js +1 -1
- package/dist/core/session/session-idle-monitor.js +10 -0
- package/dist/core/session/session-manager.js +2 -4
- package/dist/core/session/session-title.js +36 -8
- package/dist/core/system-session/memory.js +2 -7
- package/dist/core/thread/command-parser.js +6 -2
- package/dist/core/thread/ipc-operation.js +51 -36
- package/dist/core/thread/thread-operation.js +29 -61
- package/dist/core/thread/thread-service.js +57 -13
- package/dist/directory/canonical-digest.js +54 -0
- package/dist/directory/owner-directory-admission.js +114 -43
- package/dist/directory/owner-directory-agentmd-sync.js +89 -0
- package/dist/directory/owner-directory-cache.js +847 -459
- package/dist/directory/owner-directory-markdown.js +272 -0
- package/dist/directory/owner-directory-query-operation.js +195 -0
- package/dist/directory/owner-directory-remark-operation.js +147 -0
- package/dist/directory/owner-directory-remarks.js +145 -0
- package/dist/directory/owner-directory-scope.js +55 -0
- package/dist/directory/owner-directory-search.js +148 -0
- package/dist/directory/owner-directory-store.js +227 -0
- package/dist/eck/kit-renderer.js +1 -0
- package/dist/ecweb/basic-settings-service.js +4 -1
- package/dist/ecweb/message-context-service.js +13 -9
- package/dist/index.js +195 -37
- package/dist/ipc.js +86 -22
- package/dist/paths.js +11 -8
- package/dist/product.js +2 -0
- package/dist/proxy/manager.js +13 -2
- package/dist/proxy/service-supervisor.js +8 -1
- package/dist/trigger/history.js +23 -0
- package/dist/trigger/scheduler.js +3 -0
- package/dist/utils/atomic-write.js +21 -0
- package/dist/utils/cross-platform.js +35 -0
- package/dist/utils/ecweb-supervisor.js +42 -0
- package/dist/utils/error-utils.js +2 -1
- package/dist/utils/evolcore-version.js +19 -0
- package/dist/utils/host-info.js +242 -5
- package/dist/utils/instance-registry.js +28 -6
- package/dist/utils/logger.js +59 -14
- package/dist/utils/machine-info.js +46 -0
- package/dist/utils/process-introspect.js +166 -2
- package/dist/utils/startup-trace.js +245 -0
- package/ecagent/dist/agent-loop.js +27 -13
- package/ecagent/dist/harness/agent-harness.js +3 -3
- package/ecagent/dist/harness/types.d.ts +1 -0
- package/ecagent/dist/types.d.ts +1 -0
- package/kits/docs/INDEX.md +1 -1
- package/kits/docs/aun/AUN/346/266/210/346/201/257/347/261/273/345/236/213/344/270/216/345/261/236/346/200/247.md +72 -0
- package/kits/docs/evolcore/INDEX.md +3 -2
- package/kits/docs/evolcore/agent-create.md +17 -27
- package/kits/docs/evolcore/agent.md +4 -1
- package/kits/docs/evolcore/aid.md +3 -1
- package/kits/docs/evolcore/config.md +16 -5
- package/kits/docs/evolcore/ctl.md +9 -0
- package/kits/docs/evolcore/ec-capabilities.md +19 -0
- package/kits/docs/evolcore/memory-consolidation-batches.md +79 -5
- package/kits/docs/evolcore/menu-exec-schema-commands.md +2 -1
- package/kits/docs/evolcore/menu-protocol.md +1 -0
- package/kits/docs/evolcore/model.md +13 -4
- package/kits/docs/evolcore/msg.md +1 -1
- package/kits/docs/evolcore/pa-workspace.md +51 -0
- package/kits/docs/evolcore/peer.md +73 -0
- package/kits/docs/evolcore/thread-chain.md +4 -1
- package/kits/eck_manifest.json +21 -0
- package/kits/rules/06-channel.md +1 -1
- package/kits/schemas/_meta.json +12 -1
- package/kits/schemas/agent-config.schema.16.json +6 -0
- package/kits/schemas/agent-config.schema.17.json +897 -0
- package/kits/schemas/daemon.schema.9.json +8 -1
- package/kits/skills/ec-agent-create/SKILL.md +2 -2
- package/kits/skills/ec-identity/SKILL.md +45 -27
- package/kits/skills/ec-service-proxy/SKILL.md +7 -2
- package/kits/skills/personal-assistant/references/03-data-flow-and-gaps.md +4 -5
- package/kits/skills/thread-ops/SKILL.md +11 -11
- package/kits/templates/bootstrap-welcome.md +3 -15
- package/kits/templates/message-fragments/item.md +1 -1
- package/kits/templates/system-fragments/bootstrap.md +24 -23
- package/kits/templates/system-fragments/commands.md +12 -5
- package/kits/templates/system-fragments/thread.md +18 -3
- package/package.json +6 -4
- package/dist/config/contact-operation-service.js +0 -235
- package/dist/directory/owner-directory-authorization.js +0 -309
- package/kits/docs/evolcore/contact.md +0 -78
- /package/dist/config/{contact-alias.js → peer-alias.js} +0 -0
package/dist/cli/debug-mode.js
CHANGED
|
@@ -134,7 +134,7 @@ export async function resolveDebugContext(args) {
|
|
|
134
134
|
const ctxWithoutEpoch = { ...runtimeContext, daemonRuntimeEpoch: undefined };
|
|
135
135
|
Object.assign(process.env, buildTaskRuntimeEnv(ctxWithoutEpoch));
|
|
136
136
|
process.env[AGENT_DELEGATION_TOKEN_ENV] = token;
|
|
137
|
-
//
|
|
137
|
+
// contact / fs 等命令只读 EVOLCORE_SELF_AID,不走 taskRuntimeContext,单独注入
|
|
138
138
|
if (runtimeContext.selfAid)
|
|
139
139
|
process.env.EVOLCORE_SELF_AID = runtimeContext.selfAid;
|
|
140
140
|
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { resolvePaths } from '../paths.js';
|
|
2
|
+
import { daemonUnavailableMessage, getArgValue, isHelpFlag, queryDaemon, wantsHelp } from './help.js';
|
|
3
|
+
import { AGENT_DELEGATION_TOKEN_ENV, readDelegationCredential } from '../core/auth/agent-delegation.js';
|
|
4
|
+
import { DirectoryRemarkError, executeDirectoryRemarkCommand, resolveDirectoryRemarkCommand, } from '../directory/owner-directory-remark-operation.js';
|
|
5
|
+
import { DirectoryQueryError, executeDirectoryQueryCommand, resolveDirectoryQueryCommand, } from '../directory/owner-directory-query-operation.js';
|
|
6
|
+
const QUERY_ACTIONS = new Set(['find', 'show', 'list']);
|
|
7
|
+
/**
|
|
8
|
+
* `ec directory ...`
|
|
9
|
+
*
|
|
10
|
+
* - `find|show|list`:查名录。只读本地快照;`find` 未命中会触发一次有界同步。
|
|
11
|
+
* - `remark get|set|rm|list`:维护本地备注,写操作会重算 `directory.md`。
|
|
12
|
+
*
|
|
13
|
+
* 写操作必须由 daemon 执行——备注属于目标 Agent 的目录,个人助理的沙箱写不进去。
|
|
14
|
+
*/
|
|
15
|
+
export async function cmdDirectory(args) {
|
|
16
|
+
if (args.length === 0 || isHelpFlag(args[0]) || wantsHelp(args)) {
|
|
17
|
+
printHelp();
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const action = args[0];
|
|
21
|
+
const isRemark = action === 'remark';
|
|
22
|
+
if (!isRemark && !QUERY_ACTIONS.has(action)) {
|
|
23
|
+
console.error(`❌ 未知子命令: ${action}`);
|
|
24
|
+
printHelp();
|
|
25
|
+
process.exitCode = 1;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const json = getArgValue(args, '--format') === 'json';
|
|
29
|
+
const argv = isRemark ? args.slice(1) : args;
|
|
30
|
+
try {
|
|
31
|
+
const result = process.env.EVOLCORE_SESSION_ID
|
|
32
|
+
? await runManaged(argv, isRemark, json)
|
|
33
|
+
: await runLocal(argv, isRemark);
|
|
34
|
+
output(result, json);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
const known = error instanceof DirectoryRemarkError || error instanceof DirectoryQueryError;
|
|
38
|
+
console.error(`❌ ${known ? error.message : (error instanceof Error ? error.message : String(error))}`);
|
|
39
|
+
process.exitCode = 1;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function runLocal(argv, isRemark) {
|
|
43
|
+
return isRemark
|
|
44
|
+
? executeDirectoryRemarkCommand(resolveDirectoryRemarkCommand(argv))
|
|
45
|
+
: executeDirectoryQueryCommand(resolveDirectoryQueryCommand(argv));
|
|
46
|
+
}
|
|
47
|
+
function output(result, json) {
|
|
48
|
+
if (!result.ok) {
|
|
49
|
+
console.error(`❌ ${result.error}`);
|
|
50
|
+
process.exitCode = 1;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (json) {
|
|
54
|
+
console.log(JSON.stringify(result));
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
switch (result.action) {
|
|
58
|
+
case 'find': {
|
|
59
|
+
if (result.hits.length === 0) {
|
|
60
|
+
console.log(result.synced ? '(同步后仍未找到)' : '(没有匹配)');
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
for (const hit of result.hits)
|
|
64
|
+
printHit(hit);
|
|
65
|
+
if (result.synced)
|
|
66
|
+
console.log('(先做了一次同步)');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
case 'show':
|
|
70
|
+
console.log(JSON.stringify(result.entry, null, 2));
|
|
71
|
+
return;
|
|
72
|
+
case 'list': {
|
|
73
|
+
// 查询的 list 与备注的 list 同名,靠返回字段区分。
|
|
74
|
+
if ('remarks' in result) {
|
|
75
|
+
if (result.remarks.length === 0)
|
|
76
|
+
console.log('(没有备注)');
|
|
77
|
+
for (const item of result.remarks)
|
|
78
|
+
console.log(item.remark ? `${item.aid}\t${item.remark}` : item.aid);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (result.entries.length === 0)
|
|
82
|
+
console.log('(没有条目)');
|
|
83
|
+
for (const entry of result.entries) {
|
|
84
|
+
const name = typeof entry.name === 'string' ? entry.name : '';
|
|
85
|
+
console.log([name && name !== entry.aid ? name : '', entry.aid, entry.type ?? '', entry.remark ?? '']
|
|
86
|
+
.filter(Boolean).join(' | '));
|
|
87
|
+
}
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
case 'get':
|
|
91
|
+
if (!result.remark)
|
|
92
|
+
console.log('(无备注)');
|
|
93
|
+
else
|
|
94
|
+
console.log(JSON.stringify(result.remark, null, 2));
|
|
95
|
+
return;
|
|
96
|
+
case 'set':
|
|
97
|
+
console.log(`已写入备注${result.regenerated ? ',directory.md 已重算' : ''}`);
|
|
98
|
+
return;
|
|
99
|
+
case 'rm':
|
|
100
|
+
console.log(result.removed
|
|
101
|
+
? `已删除备注${result.regenerated ? ',directory.md 已重算' : ''}`
|
|
102
|
+
: '该联系人没有备注');
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function printHit(hit) {
|
|
107
|
+
const cells = [
|
|
108
|
+
hit.name && hit.name !== hit.aid ? hit.name : '',
|
|
109
|
+
hit.aid,
|
|
110
|
+
hit.type ?? '',
|
|
111
|
+
hit.remark ?? '',
|
|
112
|
+
hit.description ?? '',
|
|
113
|
+
].filter(Boolean);
|
|
114
|
+
const exact = hit.score >= 1000 ? ' [精确匹配]' : '';
|
|
115
|
+
console.log(`${cells.join(' | ')}${exact}`);
|
|
116
|
+
}
|
|
117
|
+
async function runManaged(argv, isRemark, json) {
|
|
118
|
+
const sessionId = process.env.EVOLCORE_SESSION_ID;
|
|
119
|
+
const delegationToken = readDelegationCredential();
|
|
120
|
+
if (!delegationToken) {
|
|
121
|
+
throw new DirectoryRemarkError('DELEGATION_REQUIRED', `${AGENT_DELEGATION_TOKEN_ENV} is not set for the active task`);
|
|
122
|
+
}
|
|
123
|
+
const { response, transportError } = await queryDaemon(resolvePaths().socket, {
|
|
124
|
+
type: 'directory.op',
|
|
125
|
+
argv: isRemark ? ['directory', 'remark', ...argv] : ['directory', ...argv],
|
|
126
|
+
sessionId,
|
|
127
|
+
delegationToken,
|
|
128
|
+
}, isRemark ? 10_000 : 15_000);
|
|
129
|
+
if (!response) {
|
|
130
|
+
throw new DirectoryRemarkError('DAEMON_UNAVAILABLE', daemonUnavailableMessage(transportError, 'Unable to connect to the evolcore daemon'));
|
|
131
|
+
}
|
|
132
|
+
if (!response.ok || !response.result) {
|
|
133
|
+
throw new DirectoryRemarkError(response.code || 'DIRECTORY_OPERATION_FAILED', response.error || 'directory operation failed');
|
|
134
|
+
}
|
|
135
|
+
void json;
|
|
136
|
+
return response.result;
|
|
137
|
+
}
|
|
138
|
+
function printHelp() {
|
|
139
|
+
console.log(`Usage:
|
|
140
|
+
ec directory find <query> --self <agent-aid> [--type <type>] [--scope internal|external|all] [--limit <n>]
|
|
141
|
+
ec directory show <contact-aid> --self <agent-aid>
|
|
142
|
+
ec directory list --self <agent-aid> [--type <type>] [--scope internal|external|all]
|
|
143
|
+
|
|
144
|
+
ec directory remark get <contact-aid> --self <agent-aid>
|
|
145
|
+
ec directory remark set <contact-aid> --self <agent-aid> [--remark <text>] [--body <text> | --body-file <path>]
|
|
146
|
+
ec directory remark rm <contact-aid> --self <agent-aid>
|
|
147
|
+
ec directory remark list --self <agent-aid>
|
|
148
|
+
|
|
149
|
+
find:
|
|
150
|
+
按 AID、名字、备注、描述匹配。查询串按空格切成多个词,要求全部命中。
|
|
151
|
+
默认查全部(含外部条目);--scope internal 只看内部,--scope external 只看外部。
|
|
152
|
+
本地没有匹配时会触发一次有界同步再查一遍(B 方案)。
|
|
153
|
+
|
|
154
|
+
show:返回完整记录(描述不截断),本地备注优先。
|
|
155
|
+
list:列出条目,默认只列内部联系人。
|
|
156
|
+
|
|
157
|
+
remark:
|
|
158
|
+
备注存放在 <agent>/directory/remarks/<contact-aid>.md,frontmatter md:
|
|
159
|
+
---
|
|
160
|
+
aid: <contact-aid>
|
|
161
|
+
remark: <覆盖远端备注名>
|
|
162
|
+
updated_at: <unix 秒>
|
|
163
|
+
---
|
|
164
|
+
<正文,覆盖远端描述>
|
|
165
|
+
--self 指定被维护备注的 Agent;set / rm 之后会重算该 Agent 的 directory.md。
|
|
166
|
+
|
|
167
|
+
选项:
|
|
168
|
+
--self <agent-aid> 目标 Agent,缺省取 EVOLCORE_SELF_AID
|
|
169
|
+
--format json 以 JSON 输出`);
|
|
170
|
+
}
|
package/dist/cli/index.js
CHANGED
|
@@ -6,16 +6,12 @@ import path from 'path';
|
|
|
6
6
|
import { getPackageRoot, resolvePaths } from '../paths.js';
|
|
7
7
|
import { ipcQuery } from '../ipc.js';
|
|
8
8
|
import { readDelegationCredential } from '../core/auth/agent-delegation.js';
|
|
9
|
-
import { cmdInit } from './init.js';
|
|
10
|
-
import { cmdInitWechat, cmdInitFeishu, cmdInitDingtalk, cmdInitQQBot, cmdInitWecom } from './init-channel.js';
|
|
11
9
|
import { isHelpFlag, wantsHelp, getArgValue } from './help.js';
|
|
12
10
|
import * as platform from '../utils/cross-platform.js';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import { cmdMemory } from './memory-command.js';
|
|
18
|
-
import { cmdQueue } from './queue-command.js';
|
|
11
|
+
// 子命令模块一律按需加载:`ec <cmd>` 只应为一个命令付加载成本。
|
|
12
|
+
// 实测这些模块各自 350-590ms(aun-commands/agent-command/init 最重),
|
|
13
|
+
// 静态导入会让 `ec start` 的 CLI bootstrap 多花约 300ms 而毫无收益。
|
|
14
|
+
// 本文件其余分支(task/trigger/proxy/thread/...)本来就是这个写法。
|
|
19
15
|
import { cmdStart, cmdStop, cmdRestart, cmdStatus, cmdLogs, cmdWatchCommand, cmdMv, cmdDiagnose } from './daemon-commands.js';
|
|
20
16
|
import { logCliCommand } from './command-log.js';
|
|
21
17
|
import { isInitCancelledError, printInitCancelHint } from './init-cancel.js';
|
|
@@ -42,6 +38,7 @@ Agent 与会话:
|
|
|
42
38
|
trigger 管理定时与事件触发器
|
|
43
39
|
proxy 查询和管理 daemon 服务代理
|
|
44
40
|
handoff 查询和完成跨会话回流
|
|
41
|
+
pa-workspace 绑定 PA 工作区并维护入口导航
|
|
45
42
|
model 查看或设置模型与推理强度
|
|
46
43
|
response 查看或设置响应模式
|
|
47
44
|
|
|
@@ -76,16 +73,17 @@ AUN:
|
|
|
76
73
|
|
|
77
74
|
环境变量:
|
|
78
75
|
EVOLCORE_HOME 数据目录(默认: ~/.evolcore)
|
|
79
|
-
LOG_LEVEL
|
|
76
|
+
LOG_LEVEL 日志级别(TRACE/DEBUG/INFO/WARN/ERROR/FATAL,默认: INFO)
|
|
80
77
|
MESSAGE_LOG 消息日志(默认: true)
|
|
81
|
-
EVENT_LOG 事件日志(默认: true
|
|
78
|
+
EVENT_LOG 事件日志(默认: true)
|
|
79
|
+
CHANNEL_LOGS 渠道边界审计日志(默认: false;也可用 daemon.json.debug.channelLogs)`;
|
|
82
80
|
function printLifecycleHelp(command) {
|
|
83
81
|
const help = {
|
|
84
82
|
start: `用法: ec start [--foreground] [--diagnose|-d] [--debug] [--as-mode dev|install]\n\n --foreground 前台运行,适合 systemd 或容器直接管理\n --diagnose, -d 以诊断模式启动 daemon\n --debug 调试模式:注册调试 IPC,可在宿主终端以任意 session 身份发命令\n --as-mode 覆盖运行模式判定(仅本次启动生效,不写配置):\n install = 按安装模式(校验随包文件完整性,篡改自动恢复)\n dev = 按开发模式(不校验随包文件)`,
|
|
85
83
|
stop: '用法: ec stop\n\n停止当前 EVOLCORE_HOME 下运行的 EvolCore 服务。',
|
|
86
84
|
restart: `用法: ec restart [--clear] [--diagnose|-d]\n\n --clear 同时清理跨 HOME 残留的 EvolCore 主进程\n --diagnose, -d 以诊断模式启动新 daemon`,
|
|
87
85
|
status: '用法: ec status [--format json]\n\n查看 daemon、Agent、渠道与队列运行状态。JSON 模式输出结构化状态快照。',
|
|
88
|
-
logs: `用法: ec logs [选项]\n\n --level <
|
|
86
|
+
logs: `用法: ec logs [选项]\n\n --level <trace|debug|info|warn|error|fatal> 最低日志级别\n --module <name> 只显示指定模块\n --raw 原始输出\n --no-color 禁用颜色`,
|
|
89
87
|
watch: `用法: ec watch [logs|log|aid|msg|diag|web|session]\n\n ec watch 打开监控选择菜单\n ec watch logs 选择日志类型后监控\n ec watch log <类型...> 直接监控指定日志类型\n ec watch aid 监控 AID 连接\n ec watch msg 打开消息 TUI\n ec watch diag 实时诊断消息生命周期(AUN→daemon→任务)\n ec watch web 安装/升级并启动 EC Web\n ec watch session ec watch web 的兼容别名`,
|
|
90
88
|
'restart-monitor': '用法: ec restart-monitor\n\n运行内 daemon 重启与升级监控器。',
|
|
91
89
|
diagnose: '用法: ec diagnose [--codex-hook] [--claude-sandbox] [--codex-sandbox]\n\n检查配置、数据库、进程和编译产物;配置 Codex/Claude Agent 时检查对应 Linux 沙箱。\n\n --codex-hook 运行 Windows Codex managed hook 启动探针。\n --claude-sandbox 即使未配置 Claude 也运行沙箱检查。\n --codex-sandbox 即使未配置 Codex 也运行 Codex bwrap/userns 探针。',
|
|
@@ -173,25 +171,25 @@ export async function main(args) {
|
|
|
173
171
|
if (strippedArgs[1] === 'wechat') {
|
|
174
172
|
const { suppressSdkLogs } = await import('../aun/aid/index.js');
|
|
175
173
|
suppressSdkLogs();
|
|
176
|
-
await cmdInitWechat();
|
|
174
|
+
await (await import('./init-channel.js')).cmdInitWechat();
|
|
177
175
|
}
|
|
178
176
|
else if (strippedArgs[1] === 'feishu') {
|
|
179
177
|
const { suppressSdkLogs } = await import('../aun/aid/index.js');
|
|
180
178
|
suppressSdkLogs();
|
|
181
|
-
await cmdInitFeishu();
|
|
179
|
+
await (await import('./init-channel.js')).cmdInitFeishu();
|
|
182
180
|
}
|
|
183
181
|
else if (strippedArgs[1] === 'dingtalk') {
|
|
184
182
|
const { suppressSdkLogs } = await import('../aun/aid/index.js');
|
|
185
183
|
suppressSdkLogs();
|
|
186
|
-
await cmdInitDingtalk();
|
|
184
|
+
await (await import('./init-channel.js')).cmdInitDingtalk();
|
|
187
185
|
}
|
|
188
186
|
else if (strippedArgs[1] === 'qqbot') {
|
|
189
187
|
const { suppressSdkLogs } = await import('../aun/aid/index.js');
|
|
190
188
|
suppressSdkLogs();
|
|
191
|
-
await cmdInitQQBot();
|
|
189
|
+
await (await import('./init-channel.js')).cmdInitQQBot();
|
|
192
190
|
}
|
|
193
191
|
else if (strippedArgs[1] === 'wecom') {
|
|
194
|
-
await cmdInitWecom();
|
|
192
|
+
await (await import('./init-channel.js')).cmdInitWecom();
|
|
195
193
|
}
|
|
196
194
|
else if (strippedArgs[1] && !strippedArgs[1].startsWith('-')) {
|
|
197
195
|
const supported = ['feishu', 'wechat', 'dingtalk', 'qqbot', 'wecom'];
|
|
@@ -208,6 +206,7 @@ export async function main(args) {
|
|
|
208
206
|
}
|
|
209
207
|
const { suppressSdkLogs } = await import("../aun/aid/index.js");
|
|
210
208
|
suppressSdkLogs();
|
|
209
|
+
const { cmdInit } = await import('./init.js');
|
|
211
210
|
const initialized = await cmdInit({ web: true });
|
|
212
211
|
if (!initialized && process.exitCode == null)
|
|
213
212
|
process.exitCode = 1;
|
|
@@ -223,6 +222,7 @@ export async function main(args) {
|
|
|
223
222
|
process.exitCode = 1;
|
|
224
223
|
break;
|
|
225
224
|
}
|
|
225
|
+
const { cmdInit } = await import('./init.js');
|
|
226
226
|
const initialized = await cmdInit({
|
|
227
227
|
nonInteractive,
|
|
228
228
|
baseagent: getArgValue(strippedArgs, '--baseagent'),
|
|
@@ -335,7 +335,7 @@ export async function main(args) {
|
|
|
335
335
|
printLifecycleHelp('logs');
|
|
336
336
|
break;
|
|
337
337
|
}
|
|
338
|
-
cmdLogs(strippedArgs.slice(1));
|
|
338
|
+
await cmdLogs(strippedArgs.slice(1));
|
|
339
339
|
break;
|
|
340
340
|
case 'watch':
|
|
341
341
|
if (wantsHelp(strippedArgs.slice(1))) {
|
|
@@ -349,7 +349,7 @@ export async function main(args) {
|
|
|
349
349
|
printLifecycleHelp('restart-monitor');
|
|
350
350
|
break;
|
|
351
351
|
}
|
|
352
|
-
await cmdRestartMonitor();
|
|
352
|
+
await (await import('./restart-monitor.js')).cmdRestartMonitor();
|
|
353
353
|
break;
|
|
354
354
|
case 'mode':
|
|
355
355
|
try {
|
|
@@ -396,13 +396,13 @@ export async function main(args) {
|
|
|
396
396
|
break;
|
|
397
397
|
}
|
|
398
398
|
case 'ctl':
|
|
399
|
-
await cmdCtl(strippedArgs.slice(1));
|
|
399
|
+
await (await import('./ctl-command.js')).cmdCtl(strippedArgs.slice(1));
|
|
400
400
|
break;
|
|
401
401
|
case 'memory':
|
|
402
|
-
await cmdMemory(strippedArgs.slice(1));
|
|
402
|
+
await (await import('./memory-command.js')).cmdMemory(strippedArgs.slice(1));
|
|
403
403
|
break;
|
|
404
404
|
case 'queue':
|
|
405
|
-
await cmdQueue(strippedArgs.slice(1));
|
|
405
|
+
await (await import('./queue-command.js')).cmdQueue(strippedArgs.slice(1));
|
|
406
406
|
break;
|
|
407
407
|
case 'task': {
|
|
408
408
|
const { cmdTask } = await import('./task-command.js');
|
|
@@ -440,19 +440,19 @@ export async function main(args) {
|
|
|
440
440
|
case 'agent': {
|
|
441
441
|
const { suppressSdkLogs } = await import('../aun/aid/index.js');
|
|
442
442
|
suppressSdkLogs();
|
|
443
|
-
await cmdAgent(strippedArgs.slice(1));
|
|
443
|
+
await (await import('./agent-command.js')).cmdAgent(strippedArgs.slice(1));
|
|
444
444
|
break;
|
|
445
445
|
}
|
|
446
446
|
case 'aid': {
|
|
447
447
|
const { suppressSdkLogs } = await import('../aun/aid/index.js');
|
|
448
448
|
suppressSdkLogs();
|
|
449
|
-
await cmdAid(strippedArgs.slice(1));
|
|
449
|
+
await (await import('./aun-commands.js')).cmdAid(strippedArgs.slice(1));
|
|
450
450
|
break;
|
|
451
451
|
}
|
|
452
452
|
case 'rpc': {
|
|
453
453
|
const { suppressSdkLogs } = await import('../aun/aid/index.js');
|
|
454
454
|
suppressSdkLogs();
|
|
455
|
-
await cmdRpc(strippedArgs.slice(1));
|
|
455
|
+
await (await import('./aun-commands.js')).cmdRpc(strippedArgs.slice(1));
|
|
456
456
|
break;
|
|
457
457
|
}
|
|
458
458
|
case 'diag': {
|
|
@@ -482,7 +482,7 @@ export async function main(args) {
|
|
|
482
482
|
case 'storage': {
|
|
483
483
|
const { suppressSdkLogs } = await import('../aun/aid/index.js');
|
|
484
484
|
suppressSdkLogs();
|
|
485
|
-
await cmdStorage(strippedArgs.slice(1));
|
|
485
|
+
await (await import('./aun-commands.js')).cmdStorage(strippedArgs.slice(1));
|
|
486
486
|
break;
|
|
487
487
|
}
|
|
488
488
|
case 'fs': {
|
|
@@ -495,7 +495,7 @@ export async function main(args) {
|
|
|
495
495
|
case 'msg': {
|
|
496
496
|
const { suppressSdkLogs } = await import('../aun/aid/index.js');
|
|
497
497
|
suppressSdkLogs();
|
|
498
|
-
await cmdMsg(strippedArgs.slice(1));
|
|
498
|
+
await (await import('./aun-commands.js')).cmdMsg(strippedArgs.slice(1));
|
|
499
499
|
break;
|
|
500
500
|
}
|
|
501
501
|
case 'handoff': {
|
|
@@ -521,7 +521,7 @@ export async function main(args) {
|
|
|
521
521
|
case 'group': {
|
|
522
522
|
const { suppressSdkLogs } = await import('../aun/aid/index.js');
|
|
523
523
|
suppressSdkLogs();
|
|
524
|
-
await cmdGroup(strippedArgs.slice(1));
|
|
524
|
+
await (await import('./aun-commands.js')).cmdGroup(strippedArgs.slice(1));
|
|
525
525
|
break;
|
|
526
526
|
}
|
|
527
527
|
case 'model': {
|
|
@@ -534,6 +534,11 @@ export async function main(args) {
|
|
|
534
534
|
await cmdSkill(strippedArgs.slice(1));
|
|
535
535
|
break;
|
|
536
536
|
}
|
|
537
|
+
case 'pa-workspace': {
|
|
538
|
+
const { cmdPaWorkspace } = await import('./pa-workspace-command.js');
|
|
539
|
+
await cmdPaWorkspace(strippedArgs.slice(1));
|
|
540
|
+
break;
|
|
541
|
+
}
|
|
537
542
|
case 'response': {
|
|
538
543
|
const { cmdResponse } = await import('./response.js');
|
|
539
544
|
await cmdResponse(strippedArgs.slice(1));
|
|
@@ -549,9 +554,14 @@ export async function main(args) {
|
|
|
549
554
|
await cmdConfig(strippedArgs.slice(1));
|
|
550
555
|
break;
|
|
551
556
|
}
|
|
552
|
-
case '
|
|
553
|
-
const {
|
|
554
|
-
await
|
|
557
|
+
case 'peer': {
|
|
558
|
+
const { cmdPeer } = await import('./peer.js');
|
|
559
|
+
await cmdPeer(strippedArgs.slice(1));
|
|
560
|
+
break;
|
|
561
|
+
}
|
|
562
|
+
case 'directory': {
|
|
563
|
+
const { cmdDirectory } = await import('./directory.js');
|
|
564
|
+
await cmdDirectory(strippedArgs.slice(1));
|
|
555
565
|
break;
|
|
556
566
|
}
|
|
557
567
|
case 'role': {
|
package/dist/cli/init-channel.js
CHANGED
|
@@ -19,7 +19,7 @@ import { ipcQuery } from '../ipc.js';
|
|
|
19
19
|
import { cmdStart } from './daemon-commands.js';
|
|
20
20
|
import * as platform from '../utils/cross-platform.js';
|
|
21
21
|
import { cleanupInstances } from '../utils/instance-registry.js';
|
|
22
|
-
import {
|
|
22
|
+
import { bindPeerAlias, getPeerSnapshot } from '../config/peer-book.js';
|
|
23
23
|
import { listStaticAgentAdmins } from '../config/peer-role-resolver.js';
|
|
24
24
|
import { askInit, InitCancelledError, isInitCancelledError, setupInitRawKeyListener, waitForInitDelay, } from './init-cancel.js';
|
|
25
25
|
function ask(rl, question) {
|
|
@@ -1408,7 +1408,7 @@ async function confirmOverwriteChannel(rl, displayName, channelName) {
|
|
|
1408
1408
|
}
|
|
1409
1409
|
async function pickContactForChannelBinding(rl, agentConfig, channelType) {
|
|
1410
1410
|
const candidates = preferredContactBindingCandidates(agentConfig);
|
|
1411
|
-
const contacts =
|
|
1411
|
+
const contacts = getPeerSnapshot(agentConfig.aid).contacts;
|
|
1412
1412
|
console.log(`\n请选择 ${channelType} 账号要绑定到的联系人 AID:`);
|
|
1413
1413
|
candidates.forEach((candidate, index) => {
|
|
1414
1414
|
console.log(` ${index + 1}. ${candidate.primaryId} (${candidate.label})`);
|
|
@@ -1438,7 +1438,7 @@ async function pickContactForChannelBinding(rl, agentConfig, channelType) {
|
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
1440
|
function preferredContactBindingCandidates(agentConfig) {
|
|
1441
|
-
const contacts =
|
|
1441
|
+
const contacts = getPeerSnapshot(agentConfig.aid).contacts;
|
|
1442
1442
|
const labels = new Map();
|
|
1443
1443
|
const add = (value, label) => {
|
|
1444
1444
|
const aid = String(value || '').trim();
|
|
@@ -1469,7 +1469,7 @@ function bindQrActorToContact(aid, binding, channelType, actorId, channelKey) {
|
|
|
1469
1469
|
return;
|
|
1470
1470
|
}
|
|
1471
1471
|
try {
|
|
1472
|
-
const changed =
|
|
1472
|
+
const changed = bindPeerAlias(aid, binding.primaryId, channelType, normalizedActor, channelKey);
|
|
1473
1473
|
const action = changed ? '已写入' : '已存在';
|
|
1474
1474
|
console.log(` ✓ 身份映射${action}: ${channelKey}:${encodeURIComponent(normalizedActor)} -> ${binding.primaryId}`);
|
|
1475
1475
|
}
|
package/dist/cli/init.js
CHANGED
|
@@ -9,7 +9,16 @@ import { saveDefaultsSafe, loadAllAgents, loadDaemonConfig, saveDaemonConfig } f
|
|
|
9
9
|
import { DEFAULT_ECWEB_PORT, ecwebService, setEcwebEnabled } from '../config/daemon-services.js';
|
|
10
10
|
import { ensureControlAgentMd, generateControlAid, resolveControlAidDomain, submitControlAidRegistration, } from '../aun/aid/control-aid.js';
|
|
11
11
|
import { isValidAid } from '../aun/aid/validation.js';
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* `agents/codex-runner.js` 是 CLI 里最重的单个模块(整包冷加载约 380ms,因为
|
|
14
|
+
* 它带着 Codex 客户端与沙箱相关的一整棵依赖)。init 只用它做一次可用性探测,
|
|
15
|
+
* 而 `ec start` 完全不经过 init —— 所以这里改成按需加载,别让启动路径付这个钱。
|
|
16
|
+
* 只有引导/初始化分支会真正走到。
|
|
17
|
+
*/
|
|
18
|
+
async function probeCodexAvailability() {
|
|
19
|
+
const { getCodexAppServerAvailability } = await import('../agents/codex-runner.js');
|
|
20
|
+
return getCodexAppServerAvailability();
|
|
21
|
+
}
|
|
13
22
|
import { resolveCodexCliPath, resolveCodexPowerShellShimPath, } from '../agents/baseagent.js';
|
|
14
23
|
import { defaultProjectsRoot } from '../utils/project-path.js';
|
|
15
24
|
import { WEB_CLI_BIN, WEB_PACKAGE_LATEST } from '../product.js';
|
|
@@ -29,8 +38,8 @@ export function expandLeadingTildePath(value, homeDir = os.homedir()) {
|
|
|
29
38
|
}
|
|
30
39
|
return value;
|
|
31
40
|
}
|
|
32
|
-
async function detectAvailable(codexAvailability
|
|
33
|
-
return detectAvailableBaseagents(codexAvailability);
|
|
41
|
+
async function detectAvailable(codexAvailability) {
|
|
42
|
+
return detectAvailableBaseagents(codexAvailability ?? await probeCodexAvailability());
|
|
34
43
|
}
|
|
35
44
|
/** Offer installation only when the probe positively identified an old CLI. */
|
|
36
45
|
export async function maybeUpgradeCodexForInit(availability, dependencies) {
|
|
@@ -56,7 +65,7 @@ export async function maybeUpgradeCodexForInit(availability, dependencies) {
|
|
|
56
65
|
};
|
|
57
66
|
}
|
|
58
67
|
return {
|
|
59
|
-
availability: (dependencies.probe ??
|
|
68
|
+
availability: await (dependencies.probe ?? probeCodexAvailability)(),
|
|
60
69
|
offered: true,
|
|
61
70
|
accepted: true,
|
|
62
71
|
};
|
|
@@ -192,8 +201,16 @@ export async function cmdInitWeb(dependencies = {}) {
|
|
|
192
201
|
console.error("❌ 主机控制 AID 未配置。");
|
|
193
202
|
return false;
|
|
194
203
|
}
|
|
204
|
+
if (config.owner) {
|
|
205
|
+
try {
|
|
206
|
+
await submitControlAidRegistration(controlAid, config.owner);
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
console.warn(`⚠️ 主机控制 AID Owner 绑定暂未提交,将由 daemon 后续重试: ${installErrorMessage(error)}`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
195
212
|
try {
|
|
196
|
-
await (dependencies.ensureAgentMd ?? ensureControlAgentMd)(controlAid);
|
|
213
|
+
await (dependencies.ensureAgentMd ?? ensureControlAgentMd)(controlAid, { ownerAid: config.owner });
|
|
197
214
|
}
|
|
198
215
|
catch (error) {
|
|
199
216
|
console.warn(`⚠️ 主机控制 AID 名片暂未发布,将由 daemon 后续重试: ${installErrorMessage(error)}`);
|
|
@@ -275,7 +292,7 @@ export async function cmdInit(options) {
|
|
|
275
292
|
return false;
|
|
276
293
|
}
|
|
277
294
|
// ── 2. 探测 baseagent ──
|
|
278
|
-
let codexAvailability =
|
|
295
|
+
let codexAvailability = await probeCodexAvailability();
|
|
279
296
|
if (!options?.nonInteractive && codexAvailability.version) {
|
|
280
297
|
console.log(`检测到 Codex CLI: ${codexAvailability.version}`);
|
|
281
298
|
}
|
|
@@ -359,7 +376,7 @@ export async function cmdInit(options) {
|
|
|
359
376
|
}
|
|
360
377
|
if (!available.includes(options.baseagent)) {
|
|
361
378
|
const reason = options.baseagent === 'codex'
|
|
362
|
-
?
|
|
379
|
+
? (await probeCodexAvailability()).reason
|
|
363
380
|
: undefined;
|
|
364
381
|
console.log(`❌ ${options.baseagent} 当前环境不可用${reason ? `:${reason}` : `(可用: ${available.join('/')})`}`);
|
|
365
382
|
return false; // 硬错误:不落 tail
|
|
@@ -494,12 +511,6 @@ export async function initTail(options = {}) {
|
|
|
494
511
|
const autoStartExplicit = options.autoStart !== undefined;
|
|
495
512
|
if (daemonConfig.aid) {
|
|
496
513
|
console.log(`✓ 控制 AID 已存在: ${daemonConfig.aid}`);
|
|
497
|
-
try {
|
|
498
|
-
await ensureControlAgentMd(daemonConfig.aid);
|
|
499
|
-
}
|
|
500
|
-
catch (e) {
|
|
501
|
-
console.error(`⚠️ 控制 AID agent.md 补全失败(本次继续,后续启动会重试): ${e?.message || e}`);
|
|
502
|
-
}
|
|
503
514
|
}
|
|
504
515
|
else {
|
|
505
516
|
try {
|
|
@@ -539,6 +550,19 @@ export async function initTail(options = {}) {
|
|
|
539
550
|
autoStartReady = applyAutostart(options.autoStart);
|
|
540
551
|
}
|
|
541
552
|
}
|
|
553
|
+
const configuredOwner = loadDaemonConfig().owner;
|
|
554
|
+
if (controlAidReady && configuredOwner) {
|
|
555
|
+
try {
|
|
556
|
+
const binding = await submitControlAidRegistration(loadDaemonConfig().aid, configuredOwner);
|
|
557
|
+
if (binding.status === 'failed' || binding.status === 'unknown') {
|
|
558
|
+
throw new Error(binding.error?.message || `Owner binding ${binding.status}`);
|
|
559
|
+
}
|
|
560
|
+
await ensureControlAgentMd(loadDaemonConfig().aid, { ownerAid: configuredOwner });
|
|
561
|
+
}
|
|
562
|
+
catch (e) {
|
|
563
|
+
console.error(`⚠️ 控制 AID agent.md 补全失败(本次继续,后续启动会重试): ${e?.message || e}`);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
542
566
|
async function handleAutostartPrompt() {
|
|
543
567
|
if (options.autoStart !== undefined) {
|
|
544
568
|
autoStartReady = applyAutostart(options.autoStart);
|
|
@@ -761,7 +785,7 @@ export async function cmdInitNonInteractive(opts, dependencies = {}) {
|
|
|
761
785
|
fail('INVALID_BASEAGENT', `invalid baseagent: ${opts.baseagent} (choose: ${BASEAGENT_CANDIDATES.join('/')})`, EXIT_USAGE, format);
|
|
762
786
|
}
|
|
763
787
|
if (!available.includes(opts.baseagent)) {
|
|
764
|
-
const reason = opts.baseagent === 'codex' ?
|
|
788
|
+
const reason = opts.baseagent === 'codex' ? (await probeCodexAvailability()).reason : undefined;
|
|
765
789
|
fail('BASEAGENT_UNAVAILABLE', `${opts.baseagent} not available${reason ? `: ${reason}` : ''}`, EXIT_USAGE, format);
|
|
766
790
|
}
|
|
767
791
|
chosenBaseagent = opts.baseagent;
|
|
@@ -840,24 +864,6 @@ export async function cmdInitNonInteractive(opts, dependencies = {}) {
|
|
|
840
864
|
controlAgentMdError = `Local certificate not found for ${controlAid}`;
|
|
841
865
|
console.error(`control AID agent.md publish skipped: local certificate not found for ${controlAid}`);
|
|
842
866
|
}
|
|
843
|
-
else {
|
|
844
|
-
try {
|
|
845
|
-
await ensureControlAgentMd(controlAid);
|
|
846
|
-
}
|
|
847
|
-
catch (e) {
|
|
848
|
-
controlAgentMdError = installErrorMessage(e);
|
|
849
|
-
// A registered control AID remains usable when the Name Service is
|
|
850
|
-
// temporarily unavailable; startup and the next init retry publication.
|
|
851
|
-
if (format === 'json') {
|
|
852
|
-
// Keep the successful init result machine-readable; surface the
|
|
853
|
-
// warning through stderr so stdout remains valid JSON.
|
|
854
|
-
console.error(`control AID agent.md publish warning: ${e?.message || e}`);
|
|
855
|
-
}
|
|
856
|
-
else {
|
|
857
|
-
console.error(`⚠️ 控制 AID agent.md 补全失败(本次继续,后续启动会重试): ${e?.message || e}`);
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
867
|
}
|
|
862
868
|
// ── 9. 先保存控制身份,再调用 Owner 绑定服务;不写本地 Owner 授权 ──
|
|
863
869
|
try {
|
|
@@ -921,5 +927,14 @@ export async function cmdInitNonInteractive(opts, dependencies = {}) {
|
|
|
921
927
|
? EXIT_USAGE : EXIT_RUNTIME;
|
|
922
928
|
return;
|
|
923
929
|
}
|
|
930
|
+
if (!controlAgentMdError) {
|
|
931
|
+
try {
|
|
932
|
+
await ensureControlAgentMd(controlAid, { ownerAid });
|
|
933
|
+
}
|
|
934
|
+
catch (error) {
|
|
935
|
+
controlAgentMdError = installErrorMessage(error);
|
|
936
|
+
console.error(`control AID agent.md publish warning: ${error instanceof Error ? error.message : String(error)}`);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
924
939
|
emitResult(result, format);
|
|
925
940
|
}
|
|
@@ -4,19 +4,22 @@ const MANAGED_TASK_COMMANDS = new Set([
|
|
|
4
4
|
'aid',
|
|
5
5
|
'agent',
|
|
6
6
|
'config',
|
|
7
|
-
'
|
|
7
|
+
'peer',
|
|
8
8
|
'ctl',
|
|
9
9
|
// These commands are authenticated again by their daemon IPC entrypoints.
|
|
10
10
|
'diag',
|
|
11
11
|
'menu-client',
|
|
12
12
|
'fs',
|
|
13
13
|
'group',
|
|
14
|
+
// Managed log reads are routed through a bounded, daemon-authorized IPC query.
|
|
15
|
+
'logs',
|
|
14
16
|
'handoff',
|
|
15
17
|
// `memory` only works inside a managed task: both subcommands require
|
|
16
18
|
// EVOLCORE_SESSION_ID and authorize through their daemon IPC entrypoints.
|
|
17
19
|
'memory',
|
|
18
20
|
'model',
|
|
19
21
|
'msg',
|
|
22
|
+
'pa-workspace',
|
|
20
23
|
'proxy',
|
|
21
24
|
'provider',
|
|
22
25
|
'queue',
|