evolcore 0.0.43-test.5 → 0.0.43-test.6
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 +47 -0
- package/bin/ecmsg.js +126 -43
- package/dist/agents/baseagent-availability.js +19 -4
- package/dist/agents/baseagent.js +2 -2
- package/dist/agents/claude-runner.js +19 -4
- package/dist/agents/codex/app-server-client.js +14 -3
- package/dist/agents/codex-runner.js +6 -6
- package/dist/aun/group/invite-service.js +3 -2
- package/dist/aun/service-proxy.js +18 -6
- package/dist/channels/aun.js +73 -10
- package/dist/cli/agent-create.js +16 -6
- package/dist/cli/aun-commands.js +9 -1
- package/dist/cli/daemon-commands.js +30 -1
- package/dist/cli/ecmsg-gateway.js +3 -1
- package/dist/cli/init.js +75 -0
- package/dist/cli/provider-command.js +1 -1
- package/dist/cli/restart-monitor.js +24 -5
- package/dist/cli/task-context.js +38 -1
- package/dist/cli/watch-logs.js +6 -4
- package/dist/config/boot-log.js +6 -4
- package/dist/config/builtin-roles.js +2 -2
- package/dist/config/config-manager.js +1 -1
- package/dist/config/peer-role-resolver.js +1 -1
- package/dist/config/provider-identity-migration.js +92 -17
- package/dist/config/provider-local-sync.js +2 -0
- package/dist/config/providers-config.js +13 -0
- package/dist/config/providers-management.js +100 -10
- package/dist/config/role-service.js +8 -8
- package/dist/config/role-store.js +22 -22
- package/dist/config/schema-migration.js +80 -87
- package/dist/config/snapshot.js +70 -41
- package/dist/core/agent-runtime.js +44 -7
- package/dist/core/baseagent-loader.js +114 -11
- package/dist/core/channel-loader.js +36 -13
- package/dist/core/channel-runtime.js +112 -42
- package/dist/core/command/command-handler.js +5 -5
- package/dist/core/command/menu-handler.js +8 -3
- package/dist/core/command/menu-protocol.js +82 -11
- package/dist/core/command/role-menu.js +27 -15
- package/dist/core/daemon-control.js +42 -15
- package/dist/core/daemon-lifecycle.js +411 -67
- package/dist/core/handoff/dispatcher.js +9 -3
- package/dist/core/handoff/runtime.js +130 -42
- package/dist/core/handoff/store.js +190 -2
- package/dist/core/handoff/types.js +5 -0
- package/dist/core/initialization/service.js +4 -4
- package/dist/core/ipc-registration.js +5 -4
- package/dist/core/lifecycle-notice.js +10 -4
- package/dist/core/message/aun-ipc-sender.js +2 -2
- package/dist/core/message/message-bridge.js +53 -4
- package/dist/core/message/message-queue.js +46 -4
- package/dist/core/message/pending-hints.js +4 -10
- package/dist/core/message/response-engine.js +10 -2
- package/dist/core/message/send-routing.js +12 -2
- package/dist/core/ownership/owner-resolver.js +1 -0
- package/dist/core/permission/ec-command-parser.js +11 -1
- package/dist/core/session/adapters/claude-session-file-adapter.js +24 -0
- package/dist/core/session/adapters/codex-session-file-adapter.js +80 -0
- package/dist/core/session/adapters/ecagent-session-file-adapter.js +22 -0
- package/dist/core/session/adapters/gemini-session-file-adapter.js +39 -0
- package/dist/core/session/session-fs-store.js +164 -3
- package/dist/core/session/session-idle-monitor.js +9 -1
- package/dist/core/session/session-manager.js +36 -2
- package/dist/directory/owner-directory-admission.js +26 -1
- package/dist/directory/owner-directory-cache.js +57 -16
- package/dist/directory/owner-directory-query-operation.js +4 -1
- package/dist/ecweb/runtime/lifecycle.js +9 -7
- package/dist/ecweb/runtime/supervisor.js +44 -27
- package/dist/index.js +548 -251
- package/dist/proxy/manager.js +38 -17
- package/dist/proxy/service-supervisor.js +65 -31
- package/dist/trigger/application-service.js +3 -1
- package/dist/trigger/audit.js +19 -4
- package/dist/trigger/authorization.js +14 -5
- package/dist/trigger/history.js +176 -7
- package/dist/trigger/manager.js +1 -3
- package/dist/trigger/scheduler.js +78 -5
- package/dist/utils/cross-platform.js +152 -4
- package/dist/utils/host-info.js +11 -8
- package/dist/utils/npm-ops.js +48 -0
- package/dist/utils/process-introspect.js +64 -1
- package/dist/utils/startup-trace.js +160 -19
- package/kits/docs/aun/ABILITY_CALLING.md +3 -3
- package/kits/docs/evolcore/INDEX.md +3 -2
- package/kits/docs/evolcore/ctl.md +2 -1
- package/kits/docs/evolcore/group.md +2 -2
- package/kits/docs/evolcore/menu-exec-schema-commands.md +1 -1
- package/kits/docs/evolcore/msg.md +13 -6
- package/kits/docs/evolcore/provider.md +21 -3
- package/kits/docs/evolcore/response.md +1 -1
- package/kits/eck_manifest.json +19 -7
- package/kits/eck_message_manifest.json +3 -3
- package/kits/rules/06-channel.md +5 -6
- package/kits/schemas/daemon.schema.1.json +5 -0
- package/kits/schemas/daemon.schema.2.json +5 -0
- package/kits/schemas/daemon.schema.3.json +2 -1
- package/kits/schemas/daemon.schema.4.json +2 -1
- package/kits/schemas/daemon.schema.5.json +2 -1
- package/kits/schemas/daemon.schema.6.json +1 -1
- package/kits/schemas/daemon.schema.7.json +1 -1
- package/kits/schemas/daemon.schema.8.json +2 -1
- package/kits/schemas/daemon.schema.9.json +2 -1
- package/kits/schemas/role-registry.schema.1.json +2 -2
- package/kits/schemas/single-session.schema.1.json +1 -1
- package/kits/schemas/single-session.schema.2.json +1 -1
- package/kits/schemas/single-session.schema.3.json +1 -1
- package/kits/skills/aid-ability/SKILL.md +7 -7
- package/kits/skills/ec-group/SKILL.md +8 -5
- package/kits/skills/ec-group-collaboration/SKILL.md +7 -7
- package/kits/skills/ec-trigger/SKILL.md +4 -4
- package/kits/skills/thread-ops/SKILL.md +10 -10
- package/kits/templates/system-fragments/commands.md +5 -5
- package/kits/templates/system-fragments/reply.md +2 -1
- package/kits/templates/system-fragments/session.md +1 -1
- package/kits/templates/system-fragments/thread.md +1 -1
- package/package.json +4 -3
package/dist/utils/npm-ops.js
CHANGED
|
@@ -334,6 +334,9 @@ export function getLocalVersion() {
|
|
|
334
334
|
* 未安装或查询失败返回 null。
|
|
335
335
|
*/
|
|
336
336
|
export function resolveGlobalPkg(pkgName) {
|
|
337
|
+
const local = resolveBundledPkg(pkgName);
|
|
338
|
+
if (local)
|
|
339
|
+
return local;
|
|
337
340
|
try {
|
|
338
341
|
const npm = resolveNpmInvocation();
|
|
339
342
|
const globalRoot = execFileSync(npm.command, [...npm.argsPrefix, 'root', '-g'], {
|
|
@@ -356,6 +359,51 @@ export function resolveGlobalPkg(pkgName) {
|
|
|
356
359
|
catch { /* not found */ }
|
|
357
360
|
return null;
|
|
358
361
|
}
|
|
362
|
+
function resolveBundledPkg(pkgName) {
|
|
363
|
+
if (pkgName !== WEB_PACKAGE_NAME)
|
|
364
|
+
return null;
|
|
365
|
+
const candidates = [
|
|
366
|
+
...(isLinkedInstall() ? [path.join(getPackageRoot(), 'ecweb', 'package.json')] : []),
|
|
367
|
+
path.join(targetPackageRoot(), 'node_modules', ...pkgName.split('/'), 'package.json'),
|
|
368
|
+
];
|
|
369
|
+
for (const file of candidates) {
|
|
370
|
+
try {
|
|
371
|
+
const pkg = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
372
|
+
if (pkg.name === pkgName && typeof pkg.version === 'string')
|
|
373
|
+
return { version: pkg.version, path: file };
|
|
374
|
+
}
|
|
375
|
+
catch { /* Try the next installation layout. */ }
|
|
376
|
+
}
|
|
377
|
+
return null;
|
|
378
|
+
}
|
|
379
|
+
/** Runtime callers must not block IPC and CLI probe callbacks while locating npm packages. */
|
|
380
|
+
export async function resolveGlobalPkgAsync(pkgName) {
|
|
381
|
+
const local = resolveBundledPkg(pkgName);
|
|
382
|
+
if (local)
|
|
383
|
+
return local;
|
|
384
|
+
try {
|
|
385
|
+
const npm = resolveNpmInvocation();
|
|
386
|
+
const { stdout } = await execFileAsync(npm.command, [...npm.argsPrefix, 'root', '-g'], {
|
|
387
|
+
encoding: 'utf8', timeout: 10_000, windowsHide: true,
|
|
388
|
+
});
|
|
389
|
+
const globalRoot = stdout.trim();
|
|
390
|
+
const candidates = [
|
|
391
|
+
...(pkgName === WEB_PACKAGE_NAME
|
|
392
|
+
? [path.join(globalRoot, MAIN_PACKAGE_NAME, 'node_modules', ...pkgName.split('/'), 'package.json')] : []),
|
|
393
|
+
path.join(globalRoot, ...pkgName.split('/'), 'package.json'),
|
|
394
|
+
];
|
|
395
|
+
for (const file of candidates) {
|
|
396
|
+
try {
|
|
397
|
+
const pkg = JSON.parse(await fs.promises.readFile(file, 'utf8'));
|
|
398
|
+
if (pkg.name === pkgName && typeof pkg.version === 'string')
|
|
399
|
+
return { version: pkg.version, path: file };
|
|
400
|
+
}
|
|
401
|
+
catch { /* Try the next installation layout. */ }
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
catch { /* npm unavailable or package not installed. */ }
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
359
407
|
/**
|
|
360
408
|
* 查询 npm registry 上指定包的最新版本。
|
|
361
409
|
* 使用 HTTP fetch 直接查 registry API,不依赖 npm CLI。
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* killing the wrong process).
|
|
8
8
|
*/
|
|
9
9
|
import fs from 'fs';
|
|
10
|
-
import { spawnSync } from 'child_process';
|
|
10
|
+
import { execFile, spawnSync } from 'child_process';
|
|
11
11
|
const isWindows = process.platform === 'win32';
|
|
12
12
|
const isMacOS = process.platform === 'darwin';
|
|
13
13
|
function readLinuxClockTicks() {
|
|
@@ -52,6 +52,69 @@ function approximateSelfStartTime() {
|
|
|
52
52
|
*/
|
|
53
53
|
const START_TIME_CACHE_TTL_MS = 5000;
|
|
54
54
|
const startTimeCache = new Map();
|
|
55
|
+
const startTimeQueries = new Map();
|
|
56
|
+
/** Daemon lifecycle queries must not block IPC, probes or startup timers. */
|
|
57
|
+
export async function getProcessStartTimeAsync(pid) {
|
|
58
|
+
if (!Number.isInteger(pid) || pid <= 0)
|
|
59
|
+
return null;
|
|
60
|
+
if (pid === process.pid)
|
|
61
|
+
return getProcessStartTime(pid);
|
|
62
|
+
const cached = startTimeCache.get(pid);
|
|
63
|
+
if (cached && Date.now() - cached.at < START_TIME_CACHE_TTL_MS)
|
|
64
|
+
return cached.startedAt;
|
|
65
|
+
const pending = startTimeQueries.get(pid);
|
|
66
|
+
if (pending)
|
|
67
|
+
return pending;
|
|
68
|
+
const query = (async () => {
|
|
69
|
+
let startedAt;
|
|
70
|
+
if (isWindows) {
|
|
71
|
+
const output = await processQuery('powershell', ['-NoProfile', '-NonInteractive', '-Command',
|
|
72
|
+
`(Get-CimInstance Win32_Process -Filter 'ProcessId=${pid}').CreationDate.ToUniversalTime().ToString('o')`], 8000);
|
|
73
|
+
startedAt = parseCimDate(output) ?? parseDateString(output);
|
|
74
|
+
if (startedAt === null) {
|
|
75
|
+
const fallback = await processQuery('wmic', ['process', 'where', `ProcessId=${pid}`, 'get', 'CreationDate', '/value'], 5000);
|
|
76
|
+
const creation = fallback.match(/CreationDate=([^\r\n]+)/)?.[1]?.trim();
|
|
77
|
+
startedAt = creation ? parseCimDate(creation) ?? parseDateString(creation) : null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else if (isMacOS) {
|
|
81
|
+
startedAt = parseDateString(await processQuery('ps', ['-p', String(pid), '-o', 'lstart='], 5000));
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
startedAt = getStartTimeLinux(pid);
|
|
85
|
+
}
|
|
86
|
+
// Do not cache an identity for a child that exited during the query.
|
|
87
|
+
if (startedAt !== null) {
|
|
88
|
+
try {
|
|
89
|
+
process.kill(pid, 0);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
if (error.code !== 'EPERM')
|
|
93
|
+
startedAt = null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (startedAt === null)
|
|
97
|
+
startTimeCache.delete(pid);
|
|
98
|
+
else
|
|
99
|
+
startTimeCache.set(pid, { at: Date.now(), startedAt });
|
|
100
|
+
return startedAt;
|
|
101
|
+
})();
|
|
102
|
+
startTimeQueries.set(pid, query);
|
|
103
|
+
try {
|
|
104
|
+
return await query;
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
if (startTimeQueries.get(pid) === query)
|
|
108
|
+
startTimeQueries.delete(pid);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function processQuery(command, args, timeout) {
|
|
112
|
+
return new Promise(resolve => {
|
|
113
|
+
execFile(command, args, { encoding: 'utf8', timeout, windowsHide: true }, (error, stdout) => {
|
|
114
|
+
resolve(error ? '' : stdout.replace(/^\uFEFF/, '').trim());
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
55
118
|
/**
|
|
56
119
|
* 获取进程启动时间(Unix 毫秒)。
|
|
57
120
|
* 拿不到时返回 null,调用方应保守处理(不杀该 PID)。
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 生命周期阶段埋点 —— 记录一次启动或停止里各阶段各花了多久,供 ECWeb 甘特图展示。
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* CLI、重启监控器和 daemon 用同一 traceId 关联:
|
|
5
5
|
* - CLI(ec start / ec stop)source='cli'
|
|
6
6
|
* - Daemon(dist) source='daemon'
|
|
7
7
|
*
|
|
8
8
|
* 启动与停止共用同一套结构,只用 `kind` 区分('startup' / 'stop'):
|
|
9
|
-
*
|
|
9
|
+
* 主流程阶段首尾相接,后台任务可重叠;都用绝对毫秒时间戳对齐。
|
|
10
|
+
* daemon 在控制面 ready 和后台任务结束时追加快照,读取时保留同一进程的最后一版。
|
|
10
11
|
*
|
|
11
12
|
* 起算点(startedAtMs)对启动是本进程启动时刻;对停止是调用方显式传入的
|
|
12
13
|
* 起算点——CLI 传 `ec stop` 的进程启动时刻,daemon 传收到 shutdown 请求的时刻。
|
|
@@ -19,6 +20,78 @@ import fs from 'node:fs';
|
|
|
19
20
|
import path from 'node:path';
|
|
20
21
|
import crypto from 'node:crypto';
|
|
21
22
|
import { resolvePaths } from '../paths.js';
|
|
23
|
+
export const STARTUP_CPU_PROFILE_REQUEST = 'startup-cpu-profile.once';
|
|
24
|
+
export const STARTUP_CPU_PROFILE_MAX_MS = 90_000;
|
|
25
|
+
export async function startRequestedStartupCpuProfile(traceId) {
|
|
26
|
+
const paths = resolvePaths();
|
|
27
|
+
try {
|
|
28
|
+
fs.unlinkSync(path.join(paths.instanceDir, STARTUP_CPU_PROFILE_REQUEST));
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
if (error.code !== 'ENOENT') {
|
|
32
|
+
const { logger } = await import('./logger.js');
|
|
33
|
+
logger.warn('[StartupCPU] Failed to consume profiling request', error);
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
const { logger } = await import('./logger.js');
|
|
38
|
+
let session;
|
|
39
|
+
try {
|
|
40
|
+
const { Session } = await import('node:inspector/promises');
|
|
41
|
+
session = new Session();
|
|
42
|
+
session.connect();
|
|
43
|
+
await session.post('Profiler.enable');
|
|
44
|
+
await session.post('Profiler.setSamplingInterval', { interval: 1_000 });
|
|
45
|
+
await session.post('Profiler.start');
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
try {
|
|
49
|
+
session?.disconnect();
|
|
50
|
+
}
|
|
51
|
+
catch { }
|
|
52
|
+
logger.warn('[StartupCPU] CPU profiling unavailable; startup continues', error);
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
const activeSession = session;
|
|
56
|
+
const startedAt = Date.now();
|
|
57
|
+
const stamp = new Date(startedAt).toISOString().replace(/[-:.]/g, '');
|
|
58
|
+
const file = path.join(paths.logs, `startup-${stamp}-${process.pid}.cpuprofile`);
|
|
59
|
+
let stopping;
|
|
60
|
+
let timer;
|
|
61
|
+
const controller = {
|
|
62
|
+
file,
|
|
63
|
+
stop(reason) {
|
|
64
|
+
return stopping ??= (async () => {
|
|
65
|
+
clearTimeout(timer);
|
|
66
|
+
const stoppedAt = Date.now();
|
|
67
|
+
try {
|
|
68
|
+
const { profile } = await activeSession.post('Profiler.stop');
|
|
69
|
+
await fs.promises.mkdir(paths.logs, { recursive: true });
|
|
70
|
+
await fs.promises.writeFile(file, JSON.stringify(profile), { encoding: 'utf8', flag: 'wx', mode: 0o600 });
|
|
71
|
+
logger.info(`[StartupCPU] Saved CPU profile: ${file} reason=${reason} durationMs=${stoppedAt - startedAt} traceId=${traceId}`);
|
|
72
|
+
await fs.promises.writeFile(`${file}.json`, JSON.stringify({
|
|
73
|
+
traceId, pid: process.pid, node: process.version, startedAt, stoppedAt,
|
|
74
|
+
durationMs: stoppedAt - startedAt, reason, samplingIntervalUs: 1_000,
|
|
75
|
+
boundary: 'daemon-election-won-to-normal-task-ready',
|
|
76
|
+
}, null, 2), { encoding: 'utf8', flag: 'wx', mode: 0o600 });
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
logger.warn('[StartupCPU] Failed to save CPU profile; startup continues', error);
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
try {
|
|
83
|
+
activeSession.disconnect();
|
|
84
|
+
}
|
|
85
|
+
catch { }
|
|
86
|
+
}
|
|
87
|
+
})();
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
timer = setTimeout(() => { void controller.stop('timeout'); }, STARTUP_CPU_PROFILE_MAX_MS);
|
|
91
|
+
timer.unref();
|
|
92
|
+
logger.info(`[StartupCPU] One-shot CPU profiling started: ${file} traceId=${traceId}`);
|
|
93
|
+
return controller;
|
|
94
|
+
}
|
|
22
95
|
/** 保留的启动/停止次数(按 traceId 去重后) */
|
|
23
96
|
export const STARTUP_TRACE_KEEP = 50;
|
|
24
97
|
/** CLI 传 traceId 给 daemon 的环境变量,让两侧记录落进同一次启动。 */
|
|
@@ -52,6 +125,9 @@ export class StartupTracer {
|
|
|
52
125
|
cursorStartMs = 0;
|
|
53
126
|
cursorDetail;
|
|
54
127
|
finished = false;
|
|
128
|
+
readyAtMs;
|
|
129
|
+
taskReadyAtMs;
|
|
130
|
+
pendingTasks = new Set();
|
|
55
131
|
constructor(source, opts = {}) {
|
|
56
132
|
this.source = source;
|
|
57
133
|
this.kind = opts.kind ?? 'startup';
|
|
@@ -87,10 +163,64 @@ export class StartupTracer {
|
|
|
87
163
|
this.cursorDetail = detail;
|
|
88
164
|
}
|
|
89
165
|
/** 直接登记一段已测好的区间(用于拿到外部时间戳的场景)。 */
|
|
90
|
-
addSpan(name, startMs, endMs, detail) {
|
|
166
|
+
addSpan(name, startMs, endMs, detail, status) {
|
|
91
167
|
if (this.finished)
|
|
92
168
|
return;
|
|
93
|
-
this.spans.push({ name, startMs, durationMs: Math.max(0, endMs - startMs), ...(detail ? { detail } : {}) });
|
|
169
|
+
this.spans.push({ name, startMs, durationMs: Math.max(0, endMs - startMs), ...(detail ? { detail } : {}), ...(status ? { status } : {}) });
|
|
170
|
+
}
|
|
171
|
+
/** 观察由已有生命周期回调报告完成的任务,不增加轮询或就绪依赖。 */
|
|
172
|
+
startTask(name, detail) {
|
|
173
|
+
if (this.finished)
|
|
174
|
+
return () => { };
|
|
175
|
+
const task = { name, startMs: Date.now(), ...(detail ? { detail } : {}) };
|
|
176
|
+
this.pendingTasks.add(task);
|
|
177
|
+
return (status = 'ok') => {
|
|
178
|
+
if (this.finished || !this.pendingTasks.has(task))
|
|
179
|
+
return;
|
|
180
|
+
this.addSpan(name, task.startMs, Date.now(), detail, status);
|
|
181
|
+
this.pendingTasks.delete(task);
|
|
182
|
+
if (this.readyAtMs !== undefined) {
|
|
183
|
+
if (this.pendingTasks.size === 0)
|
|
184
|
+
this.finish(true);
|
|
185
|
+
else
|
|
186
|
+
this.persist(true);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
/** 观察实际任务(含依赖等待),保持原有返回值和异常传播。 */
|
|
191
|
+
track(name, run, detail) {
|
|
192
|
+
const settle = this.startTask(name, detail);
|
|
193
|
+
try {
|
|
194
|
+
return run().then(value => {
|
|
195
|
+
settle(value === false ? 'cancelled' : 'ok');
|
|
196
|
+
return value;
|
|
197
|
+
}, error => {
|
|
198
|
+
settle('failed');
|
|
199
|
+
throw error;
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
settle('failed');
|
|
204
|
+
return Promise.reject(error);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/** 保存控制面就绪快照;后台任务结束后自动补写同一进程的最新快照。 */
|
|
208
|
+
ready() {
|
|
209
|
+
if (this.finished || this.readyAtMs !== undefined)
|
|
210
|
+
return;
|
|
211
|
+
this.readyAtMs = Date.now();
|
|
212
|
+
this.closeCursor(this.readyAtMs);
|
|
213
|
+
if (this.pendingTasks.size === 0)
|
|
214
|
+
this.finish(true);
|
|
215
|
+
else
|
|
216
|
+
this.persist(true);
|
|
217
|
+
}
|
|
218
|
+
/** 正常启动边界;由实际任务准入条件发布,与控制面早就绪分别记录。 */
|
|
219
|
+
tasksReady() {
|
|
220
|
+
if (this.finished || this.readyAtMs === undefined || this.taskReadyAtMs !== undefined)
|
|
221
|
+
return;
|
|
222
|
+
this.taskReadyAtMs = Date.now();
|
|
223
|
+
this.persist(true);
|
|
94
224
|
}
|
|
95
225
|
/** 瞬时事件(时长为 0 的标记)。 */
|
|
96
226
|
point(name, detail) {
|
|
@@ -115,9 +245,16 @@ export class StartupTracer {
|
|
|
115
245
|
return;
|
|
116
246
|
const now = Date.now();
|
|
117
247
|
this.closeCursor(now);
|
|
248
|
+
for (const task of this.pendingTasks) {
|
|
249
|
+
this.addSpan(task.name, task.startMs, now, task.detail, 'cancelled');
|
|
250
|
+
}
|
|
251
|
+
this.pendingTasks.clear();
|
|
118
252
|
this.finished = true;
|
|
119
253
|
if (this.cursorName)
|
|
120
254
|
this.cursorName = null;
|
|
255
|
+
this.persist(this.readyAtMs !== undefined || ok, now);
|
|
256
|
+
}
|
|
257
|
+
persist(ok, now = Date.now()) {
|
|
121
258
|
const record = {
|
|
122
259
|
traceId: this.traceId,
|
|
123
260
|
kind: this.kind,
|
|
@@ -127,6 +264,14 @@ export class StartupTracer {
|
|
|
127
264
|
startedAt: new Date(this.processStartMs).toISOString(),
|
|
128
265
|
ok,
|
|
129
266
|
totalMs: Math.max(0, now - this.processStartMs),
|
|
267
|
+
...(this.taskReadyAtMs === undefined ? {} : { taskReadyAtMs: this.taskReadyAtMs }),
|
|
268
|
+
...(this.readyAtMs === undefined ? {} : {
|
|
269
|
+
readyAtMs: this.readyAtMs,
|
|
270
|
+
backgroundState: this.pendingTasks.size ? 'pending'
|
|
271
|
+
: this.spans.some(span => span.status === 'failed') ? 'failed'
|
|
272
|
+
: this.spans.some(span => span.status === 'cancelled') ? 'interrupted' : 'complete',
|
|
273
|
+
pendingTasks: [...this.pendingTasks],
|
|
274
|
+
}),
|
|
130
275
|
meta: this.meta,
|
|
131
276
|
spans: this.spans,
|
|
132
277
|
};
|
|
@@ -175,25 +320,18 @@ function trimStartupTrace(file) {
|
|
|
175
320
|
const lines = raw.split('\n').filter(line => line.trim());
|
|
176
321
|
if (lines.length <= STARTUP_TRACE_KEEP * 2 + 20)
|
|
177
322
|
return;
|
|
178
|
-
const
|
|
323
|
+
const latest = new Map();
|
|
179
324
|
for (const line of lines) {
|
|
180
325
|
try {
|
|
181
|
-
const
|
|
326
|
+
const record = JSON.parse(line);
|
|
327
|
+
const id = record.traceId;
|
|
182
328
|
if (id)
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
catch { /* 坏行丢弃 */ }
|
|
186
|
-
}
|
|
187
|
-
const keep = new Set(Array.from(new Set(ids.sort())).slice(-STARTUP_TRACE_KEEP));
|
|
188
|
-
const kept = [];
|
|
189
|
-
for (const line of lines) {
|
|
190
|
-
try {
|
|
191
|
-
const id = JSON.parse(line).traceId;
|
|
192
|
-
if (id && keep.has(id))
|
|
193
|
-
kept.push(line);
|
|
329
|
+
latest.set(`${id}:${record.kind ?? 'startup'}:${record.source}:${record.pid}:${record.startedAtMs}`, { id, line });
|
|
194
330
|
}
|
|
195
331
|
catch { /* 坏行丢弃 */ }
|
|
196
332
|
}
|
|
333
|
+
const keep = new Set([...new Set([...latest.values()].map(record => record.id))].sort().slice(-STARTUP_TRACE_KEEP));
|
|
334
|
+
const kept = [...latest.values()].filter(record => keep.has(record.id)).map(record => record.line);
|
|
197
335
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
198
336
|
fs.writeFileSync(tmp, `${kept.join('\n')}\n`, 'utf-8');
|
|
199
337
|
fs.renameSync(tmp, file);
|
|
@@ -224,7 +362,7 @@ export function formatSlowestSpans(spans, limit = 3, prefixPattern = /^[a-z]+\./
|
|
|
224
362
|
* ——否则 `ec stop` 只报 CLI 的 1.2 秒,真正慢的 18 秒藏在对端。
|
|
225
363
|
*/
|
|
226
364
|
export function findTraceRecord(traceId, source) {
|
|
227
|
-
return readStartupTraces().find(record => record.traceId === traceId && record.source === source) ?? null;
|
|
365
|
+
return readStartupTraces().reverse().find(record => record.traceId === traceId && record.source === source) ?? null;
|
|
228
366
|
}
|
|
229
367
|
/** 读原始记录(ECWeb 侧也有一份独立实现,不复用本文件的路径工具)。 */
|
|
230
368
|
export function readStartupTraces() {
|
|
@@ -247,5 +385,8 @@ export function readStartupTraces() {
|
|
|
247
385
|
}
|
|
248
386
|
catch { /* 坏行跳过 */ }
|
|
249
387
|
}
|
|
250
|
-
|
|
388
|
+
// 同一进程在 ready 和各后台任务完成时追加快照,只读取最后一版。
|
|
389
|
+
return [...new Map(records.map(record => [
|
|
390
|
+
`${record.traceId}:${record.kind ?? 'startup'}:${record.source}:${record.pid}:${record.startedAtMs}`, record,
|
|
391
|
+
])).values()];
|
|
251
392
|
}
|
|
@@ -112,11 +112,11 @@ Windows 或复杂 JSON 优先使用 `--payload-file`:通过文件工具把原
|
|
|
112
112
|
`$TMPDIR`,再单独执行发送。PowerShell 路径用 `"$env:TMPDIR/obs_payload.json"`,Git Bash 用
|
|
113
113
|
`"$TMPDIR/obs_payload.json"`;文件内容不加 Shell 转义。该选项与 `--payload` 及位置文本互斥,
|
|
114
114
|
设备选择、加密和请求等待规则相同,详见 `../evolcore/msg.md`。
|
|
115
|
-
在当前 Windows PowerShell 托管环境中,`
|
|
115
|
+
在当前 Windows PowerShell 托管环境中,`ecmsg` 的 `--payload` 使用单引号包裹,并在 JSON 内每个
|
|
116
116
|
双引号前加反斜杠,例如:
|
|
117
117
|
|
|
118
118
|
```text
|
|
119
|
-
|
|
119
|
+
ecmsg send --to <provider-aid> --payload '{\"type\":\"ability\",\"role\":\"call\",\"call_id\":\"<call-id>\",\"operation_id\":\"<operation-id>\",\"ability_path\":\"<path>\",\"definition_id\":\"<definition-id>\",\"params\":{},\"ttl\":<ttl-seconds>,\"async\":false}' --device-id <provider-device-id> --encrypt yes --return required --timeout <ttl-seconds>s --format json
|
|
120
120
|
```
|
|
121
121
|
|
|
122
122
|
`device/status` 且 `params.action=read` 是 AID 级在线设备状态查询,命令不要带 `--device-id`,
|
|
@@ -136,7 +136,7 @@ payload/params 也不指定设备。各支持并已发布该能力的在线设
|
|
|
136
136
|
payload 没有 `sent_at` 时,EvolCore 在实际发送前自动补当前 Unix 毫秒时间戳,Caller 不需要
|
|
137
137
|
自己取当前时间。时限按下方“时限估算”确定。
|
|
138
138
|
EvolApp v1 必须使用 `--encrypt`;不能沿用普通聊天的明文 `[reply]` 设置。
|
|
139
|
-
这套转义只针对当前 PowerShell 到 `
|
|
139
|
+
这套转义只针对当前 PowerShell 到 `ecmsg` 的调用链,不直接套用到其他 Shell。
|
|
140
140
|
|
|
141
141
|
Ability 调用通常由业务协议提供:
|
|
142
142
|
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
运行时 evolcore 会通过 `commands` fragment 按当前场景(有无 peer/group、对端角色)
|
|
5
5
|
注入一张精简能力卡,指向本目录下对应文档;需要完整用法时 Read 对应文档。
|
|
6
6
|
|
|
7
|
-
>
|
|
7
|
+
> 对外发送统一走 `ecmsg`(本端恒为当前会话本端,不写 `--from`);
|
|
8
|
+
> 当前渠道是否需要 CLI 回复,以运行时注入的
|
|
8
9
|
> `[reply]` 规则为准,active 的 `[channel]` 补充扩展能力。参数不是全局通用的:`--format json` 仅用于对应帮助中明确支持的命令,
|
|
9
10
|
> `--app <name>` 仅用于消息 pull/ack、消费类 RPC 和明确支持 app slot 的文件操作。
|
|
10
11
|
|
|
@@ -32,7 +33,7 @@ ECWeb 托管重启、端口占用与升级失败处理见 `ecweb-lifecycle.md`
|
|
|
32
33
|
|
|
33
34
|
Windows 上 Codex 托管任务出现 `helper_sandbox_lock_failed`、`SetNamedSecurityInfoW ... 5`、`unelevated ... cannot enforce deny-read` 或 daemon 管道 `EPERM` 时,参见 `codex-windows-sandbox.md`。
|
|
34
35
|
|
|
35
|
-
## 对外通信 / 网络类(连 AUN
|
|
36
|
+
## 对外通信 / 网络类(连 AUN,发送统一走 `ecmsg`)
|
|
36
37
|
|
|
37
38
|
| 命令集 | 用途 | 触发词 | 适用场景 | 文档 |
|
|
38
39
|
|--------|------|--------|----------|------|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
群聊场景下收发消息、管理群与成员。触发词:群发/建群/邀请/踢人/退群/群成员/群聊协作/分工/任务分派。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**发消息统一用 `ecmsg send`**(本端恒为当前会话本端,群目标用 `--to <群AID>`)。本页其余 `ec group` 命令用于群管理;宿主终端场景下它们也承担发送。
|
|
6
6
|
|
|
7
7
|
本命令覆盖常用消息、基础生命周期、成员操作、角色/群主管理、封禁、屏蔽、成员状态、暂停/恢复和群规则。生产环境 agent 优先使用本页列出的 `ec group` 命令。
|
|
8
8
|
|
|
@@ -266,7 +266,7 @@ ec group mention <from> <group-id> --clear
|
|
|
266
266
|
- `--format json` — 对支持结构化结果的子命令输出 JSON
|
|
267
267
|
- `--app <name>` — 仅 `pull` / `ack` 指定独立消费 slot
|
|
268
268
|
- `--aun-path <path>` — 指定 AUN keystore 根
|
|
269
|
-
- `--encrypt` — 仅 send
|
|
269
|
+
- `--encrypt yes|no|auto` — 仅 send(`ecmsg send`),默认 `auto`:被对端消息触发时沿用该消息的状态,主动发起时明文
|
|
270
270
|
- `create` 会通过 SDK 自动生成并导入群 `group_aid` 身份。
|
|
271
271
|
- 默认群名遇到明确的身份占用错误时最多尝试 5 次;显式指定的名称不会自动更换,超时或身份导入失败也不会换名重建。
|
|
272
272
|
- 创建结果以服务端返回的 `group_aid` 为准;与请求不一致时输出提示,JSON 结果包含 `warning` 和 `requested_group_aid`。
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
|
|
177
177
|
| 字段 | 类型 | 默认 | 作用 |
|
|
178
178
|
|---|---|---|---|
|
|
179
|
-
| `pre_tool_1stmsgchk` | boolean | `true` | 意图表达门禁:每条新消息计数重置为 15,每轮结束后有意图表达成功则清零否则 +1。计数 = 15 时全部放行并提示下一轮要先表达意图,≥ 16 时只放行
|
|
179
|
+
| `pre_tool_1stmsgchk` | boolean | `true` | 意图表达门禁:每条新消息计数重置为 15,每轮结束后有意图表达成功则清零否则 +1。计数 = 15 时全部放行并提示下一轮要先表达意图,≥ 16 时只放行 ecmsg send |
|
|
180
180
|
| `tool_use_reminder` | boolean | `true` | 意图表达门禁与队列提醒:开启意图表达门禁(规则同 pre_tool_1stmsgchk),同时保留队列未读提醒 |
|
|
181
181
|
|
|
182
182
|
- schema 里的 `default` 即**运行时出厂默认**——宿主组装 `modeConfig` 时先铺这层默认(`coordinator.schemaDefaults`),再叠用户显式桶值;flow 层不再硬编码默认。
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
## Agent 会话中的 Shell 调用边界
|
|
6
6
|
|
|
7
|
-
在 EvolCore
|
|
7
|
+
在 EvolCore 托管会话中,每次工具调用只能执行一条完整的命令。禁止把
|
|
8
8
|
`command -v`、`ec aid`、`&&`、`||`、`;`、`|`、重定向、子 shell、`bash -lc` 或其它脚本
|
|
9
|
-
和 `
|
|
9
|
+
和 `ecmsg` 拼在一起。不要做单独的 CLI 探测;直接调用本页的单条命令,读取结构化结果后
|
|
10
10
|
再决定下一步。工具审批被拒绝时应报告原始错误并停止,不要通过追加命令或提权参数重试。
|
|
11
11
|
|
|
12
|
-
发送统一入口是 `ecmsg send
|
|
12
|
+
发送统一入口是 `ecmsg send`,本端恒为当前会话本端;目标三种说法:
|
|
13
13
|
|
|
14
14
|
| 目标 | 写法 |
|
|
15
15
|
|---|---|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
| 指定话题 | `ecmsg send '<text>' --thread <话题id>` |
|
|
18
18
|
| 指定对端 | `ecmsg send '<text>' --to <对端ID>` |
|
|
19
19
|
|
|
20
|
-
`--thread` 只接受 `thread-…` 与 `main:<aidA>:<aidB
|
|
20
|
+
`--thread` 只接受 `thread-…` 与 `main:<aidA>:<aidB>`。宿主终端没有会话上下文时,`ec msg send <from> <to> '<text>'` 是同一通道的非托管形态。
|
|
21
21
|
|
|
22
22
|
## 发送消息
|
|
23
23
|
|
|
@@ -65,6 +65,10 @@ Windows 或包含复杂 JSON 时优先使用 `--payload-file`。临时文件先
|
|
|
65
65
|
每一行都必须单独执行,且是该次 shell 调用中的唯一命令。
|
|
66
66
|
|
|
67
67
|
发送相关选项:
|
|
68
|
+
- `--to <对端ID>` — 指定对端(群 AID 或对方 AID,按关系判定类型);省略表示当前会话对端/群
|
|
69
|
+
- `--check-every <时长>` — 跨话题复查周期(5m/30m/2h/1d);省略时跨话题补默认 20m,同话题不建复查
|
|
70
|
+
- `--mention '<aid1>,<aid2>'` / `--mention-all` — 仅群聊 @成员;私聊带 `--mention` 会被拒绝
|
|
71
|
+
- `--trigger-prompt <text>` — 跨话题时追加到复查 Trigger 提示词(需与 `--thread` 同用)
|
|
68
72
|
- `--text-from-file <path>` — 从文件读取文本(UTF-8),用于超长消息或避免 Shell 转义
|
|
69
73
|
- `--handoff-context <text>` — 仅托管私聊跨会话发送可用,1–65536 字符;为本 Agent 的目标会话保存额外交接上下文,处理对端回复时补入。该内容不加入网络 payload,实际发送正文不变;不能用来迁移整个运行中的任务。
|
|
70
74
|
- `--encrypt` — 端到端加密
|
|
@@ -99,7 +103,10 @@ ec peer unblock <target-aid> --self <self-aid>
|
|
|
99
103
|
|
|
100
104
|
非托管环境的 `ec msg send` 是独立 AUN CLI 发送,不读取或要求 `agents/<aid>/config.json`,因此不会触发这套 Agent 联系人准入判断。
|
|
101
105
|
|
|
102
|
-
在 EvolCore 会话内,发送会经过当前 session 的 self/peer/role
|
|
106
|
+
在 EvolCore 会话内,发送会经过当前 session 的 self/peer/role 鉴权。默认目标是当前对端;
|
|
107
|
+
要联系当前对端以外的对象,用 `ecmsg send '<text>' --to <对方AID>`(首次联系直接发出),
|
|
108
|
+
或先 `ec thread list <对方AID>` 选话题(没有就 `ec thread create`),再用
|
|
109
|
+
`ecmsg send '<text>' --thread <threadId> --check-every <时长>` 发送(`--check-every` 可省略)。**跨话题会自动创建复查**(缺省 20m),到期后系统向**目标话题**投递一条【跨话题复查】通知(不新建会话),由目标话题侧的 agent 决定结束、调整周期或继续。完整话题路由操作序列见 `[thread]` 段。没有成功回执(含 `message_id`/`status`)不得声称已发送。
|
|
103
110
|
|
|
104
111
|
成功输出:`✓ 已发送 from=… to=… thread=… chatType=… message_id=<id> seq=<n> status=<status>`
|
|
105
112
|
|
|
@@ -157,7 +164,7 @@ ec msg request get <self-aid> <request-id> --format json
|
|
|
157
164
|
> 正文写法:含空格/换行/特殊字符时用引号包起来;纯短词可不包,但多空格会被压成一个。
|
|
158
165
|
> 正文恰好以 `--` 开头:带空格的(如 `"--file 是正文"`)会被正确识别为正文;
|
|
159
166
|
> 若正文**精确等于**某个 flag 名(如要发送文本 `--encrypt`),用 `--` 分隔:
|
|
160
|
-
> `
|
|
167
|
+
> `ecmsg send -- --encrypt`
|
|
161
168
|
|
|
162
169
|
## 拉取消息
|
|
163
170
|
|
|
@@ -35,7 +35,7 @@ ec provider sync [--format json]
|
|
|
35
35
|
`ec provider sync` 通过在线 daemon 执行以下一次性事务,不需要输入文件。旧命令名 `sync-local` 不再接受:
|
|
36
36
|
|
|
37
37
|
1. 复用初始化界面的本机基座导入机制,扫描 Claude、Codex、Gemini 和 ecagent 的本机连接;只导入具有有效密钥的来源。同域沿用原有导入合并规则,保留已存在的凭据和服务设置,补充缺少的服务。
|
|
38
|
-
2. 将可识别域名的 Provider ID 转为稳定八位格式,同步 defaults、Agent 和 relation 配置内的 Provider/fallback
|
|
38
|
+
2. 将可识别域名的 Provider ID 转为稳定八位格式,同步 defaults、Agent 和 relation 配置内的 Provider/fallback 引用;冻结初始化计划及其请求指纹不修改,单独记录运行时 Provider 迁移绑定。在线同步暂留旧 ID aliases,到下次成功启动迁移后自动清除。
|
|
39
39
|
3. 仅将全局 defaults 的 `active_baseagent` 改为 `ecagent`;不覆盖已有 Agent 的显式基座或模型选择。
|
|
40
40
|
4. 若注册表存在 `provider-96659517`,从其适用于 ecagent 的实时模型目录选择已启用、已列出的 `deepseek…flash` 模型;多个版本按模型 ID 的数字版本降序选择,例如 `deepseek-v4.1-flash` 优先于 `deepseek-v4-flash`。写入全局 `baseagents.ecagent.provider/model`,不写入拼错的 `deekseek` 或通配符字面量。与新模型不兼容的全局 effort 会清除。
|
|
41
41
|
|
|
@@ -45,10 +45,28 @@ ec provider sync [--format json]
|
|
|
45
45
|
|
|
46
46
|
变量未设置或为空返回 `PROVIDER_ENV_BASE_URL_MISSING`;URL 无效、包含嵌套环境变量、认证信息、查询串或片段返回 `PROVIDER_ENV_BASE_URL_INVALID`,均不落盘。已声明 domain 与实际地址不匹配时也拒绝。固化后环境变量变化不会自动改动该 Provider;修改地址须显式更新配置。返回 `materializedBaseUrls` 表示本次解析的环境变量地址数量,不回显实际地址。普通启动迁移保持原有行为,不自动展开环境变量。
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
提交前对受影响配置加锁、验证未被其他写入者改动,并通过统一配置快照保存迁移前版本。提交中写入失败会回滚,异常中断由启动迁移恢复。输出只包含导入来源、ID/aliases、待处理项、全局选择、变更数量和备份版本号,不回显密钥。JSON 的 backup 现为统一快照版本(如 v100),不再是独立迁移备份目录。宿主控制终端或 trusted fullaccess 任务可执行;普通 DaemonOwner 托管只读授权不允许执行此命令。
|
|
49
49
|
|
|
50
50
|
同域旧条目迁移冲突时,`PROVIDER_CONFLICT` 提示列出冲突 Provider ID、域名及字段,例如 `common.apiKey`、`services.text.path`、`services.text.models`;JSON 的 `data.kind=provider_migration_conflict`,并提供 `providerIds`、`domain`、`fields`。仅报告字段名,不返回密钥、请求头、查询参数、端点路径或模型设置的值。凭据按配置原文比较,环境变量引用与静态密钥不同不代表实际密钥一定不同。发生冲突不落盘,需核对这些字段后再同步,不自动选边覆盖。
|
|
51
51
|
|
|
52
|
+
## 启动迁移收尾
|
|
53
|
+
|
|
54
|
+
纯 CLI `ec init` 在完成 Baseagent 选择与默认配置保存后,扫描检测到的基座并自动导入有效的本机 Provider 连接;同域沿用服务合并规则,不覆盖已有凭据和模型设置。已有可用选择优先保留,否则绑定本次导入或注册表中适用的 Provider;来源缺失、导入冲突或最终仍无可用连接时输出脱敏提醒。非交互 JSON 输出在 `providers.imported` / `providers.warnings` 提供结果,不输出密钥。此步骤不等同于 `ec provider sync`,不强制切换默认基座或模型。
|
|
55
|
+
|
|
56
|
+
`ec init --web` 不执行终端侧 Baseagent 扫描或 Provider 自动导入;这些步骤由网页初始化流程负责。终端仍检查并准备启动所需的主机控制 AID,不停止或重启已运行的 daemon。
|
|
57
|
+
|
|
58
|
+
本机 Provider 合并导入和 ECWEB 草稿导入合并旧条目时,立即升级为域名稳定 ID,并在同一快照及事务中迁移配置引用;冻结初始化计划保持不变,通过运行时绑定迁移。在线暂留旧 ID 别名,到下次成功启动后清理。哈希碰撞、重复域名无法安全归并或并发修改时拒绝提交,不覆盖其他条目。历史内嵌连接迁移新增 Provider 时也直接生成稳定 ID;同域不兼容的凭据不再通过递增编号绕过冲突。
|
|
59
|
+
|
|
60
|
+
启动时,在加载 Agent 前恢复未完成的迁移事务,再更新全局默认、Agent、关系配置和 fallback,以及初始化记录和 ECWeb 创建工作流中的运行时 Provider 绑定。初始化原始 plan、fingerprint、创建凭据和请求 ID 保持不变,避免破坏重试与恢复的一致性。统一配置快照已覆盖初始化记录和 ECWeb 创建状态,迁移前版本包含全部受影响文件,而非仅 providers.json。
|
|
61
|
+
|
|
62
|
+
Provider 不再创建独立的长期迁移备份,版本查看、恢复和保留清理由现有 ec config 快照机制统一管理;既有历史迁移备份保留不动。短期事务日志仅用于本次操作的失败回滚和中断恢复,成功提交后删除。若 configSnapshots=false,不创建版本备份,在线 sync 返回 CONFIG_SNAPSHOTS_DISABLED 告警,启动迁移也记录告警,但事务日志回滚仍启用;快照开启但写入失败则在修改配置前中止。
|
|
63
|
+
|
|
64
|
+
新快照记录扩展后的文件范围;恢复到尚未收录初始化状态的历史快照时,不因这些文件缺席而删除当前初始化状态。新快照则能够恢复这些文件的内容或原本不存在的状态。
|
|
65
|
+
|
|
66
|
+
引用更新与 aliases 清理作为同一事务提交,providers.json 最后写入。配置无法读取、迁移冲突或并发写入时拒绝提交;提交失败回滚,异常中断由下次启动恢复。成功后旧 ID 不再可用;重复启动无变更时不产生新备份。外部脚本应改用固定 ID,历史备份不重写。启动收尾不导入本机连接、不修改默认基座或模型,也不展开环境变量。
|
|
67
|
+
|
|
68
|
+
托管 Codex 使用解析后的固定 Provider ID 生成运行时 model_provider,并在 thread/start、thread/resume、thread/fork 显式指定当前 Provider,覆盖历史会话中的旧 Provider 选择;原 thread ID 和历史不修改,不以新建会话代替恢复。不会修改用户原生 Codex config.toml 的 model_provider/model_providers。模型目录查询与推理使用相同的运行时命名规则。
|
|
69
|
+
|
|
52
70
|
## 完整对象示例
|
|
53
71
|
|
|
54
72
|
~~~json
|
|
@@ -73,7 +91,7 @@ Provider identity 取完整规范化 hostname:小写、IDN 转 Punycode、去
|
|
|
73
91
|
|
|
74
92
|
常见错误:INVALID_ARGUMENT(参数/JSON)、NOT_FOUND(未知 ID)、CONFLICT(revision 冲突、仍有引用或引用无法校验)、PROVIDER_CONFLICT(域名已存在)、PROVIDER_ID_COLLISION(八位哈希碰撞)、PROVIDER_DOMAIN_IMMUTABLE(不能修改已有域名)、PROVIDER_DOMAIN_REQUIRED/INVALID/MISMATCH(域名缺失、非法或与地址不符)、FORBIDDEN(身份/入口不具备授权)、INVALID_CONTROL_TOKEN(宿主凭据无效)、DAEMON_UNAVAILABLE(daemon 不在线)。
|
|
75
93
|
|
|
76
|
-
|
|
94
|
+
升级时在启动阶段通过统一快照备份并迁移注册表和实际选择引用,冻结初始化计划保留原文并通过局部运行时绑定兼容,成功后清理全局 aliases。旧环境变量地址未声明 domain、localhost 或 IP 地址暂保留旧 ID,并报告待处理;不同凭据或服务端点冲突须先人工协调,迁移不会静默覆盖。
|
|
77
95
|
|
|
78
96
|
不提供 if-revision 等参数。daemon 自动读取当前 revision 并通过共享层 CAS 提交;冲突时不自动重试。配置变更用于后续新请求,无需 reload/restart;首次安装本功能的 daemon 代码仍需宿主重新加载。
|
|
79
97
|
|
|
@@ -45,7 +45,7 @@ ec response config set <key> <value> --mode <mode-id> --self <aid> [--peer <X>]
|
|
|
45
45
|
|
|
46
46
|
paactive 的 `show_activities=all/text/none` 保持原显示设置:`all` 展示过程文本和工具活动,`text` 展示过程文本,`none` 隐藏中间过程;最终模型文本均投影为 activity。activity 投递失败不会降级成普通回复。
|
|
47
47
|
|
|
48
|
-
proactive 也遵守 `show_activities`:`all` 投递全部 thought,`text` 只投递模型文本,`none` 不投递 thought(含最终模型文本)。未显式配置时,群聊默认 `none`,私聊默认 `all`;显式配置仍按关系 > Agent > defaults 覆盖。群聊通过 Menu 或 `ec config` 调整,私聊也可使用 `/activity all|text|none`。本地任务活动记录、正式 `
|
|
48
|
+
proactive 也遵守 `show_activities`:`all` 投递全部 thought,`text` 只投递模型文本,`none` 不投递 thought(含最终模型文本)。未显式配置时,群聊默认 `none`,私聊默认 `all`;显式配置仍按关系 > Agent > defaults 覆盖。群聊通过 Menu 或 `ec config` 调整,私聊也可使用 `/activity all|text|none`。本地任务活动记录、正式 `ecmsg send` 和任务状态通知不受此参数影响。
|
|
49
49
|
|
|
50
50
|
## 作用域(越具体越优先:关系 > agent > 全局)
|
|
51
51
|
|